import super_simple_graphics.canvas as sg w = 1000 h = 600 sg.create_canvas(w, h) sg.fill_canvas(200, 200, 200) sg.set_pen_style('NoPen') sg.set_brush_color(180, 180, 180) sg.draw_rect(w / 2, h / 4 * 3, w, h / 2) sg.set_brush_color(200, 200, 200) sg.draw_rect(w / 2, h / 4, w, h / 2) sg.set_brush_style_linear_gradient(w / 2 - 50, h / 2, w / 2 + 80, h / 2, 80, 80, 80, 120, 120, 120) sg.draw_ellipse(w / 2 + 50, h / 2 - 95, 260, 50) sg.set_brush_style_radial_gradient(w / 2 - 50, h / 2 + 50, 120, 250, 250, 250, 60, 60, 60) sg.draw_circle(w / 2, h / 2, 100) sg.show_canvas()
Created on Wed Apr 1 12:23:42 2020 @author: Kevin Ma """ import math, random import super_simple_graphics.canvas as sg data = { "Product A": 0.44, "Product B": 0.28, "Product C": 0.23, "Product D": 0.05 } sg.create_canvas(600, 1000) sg.fill_canvas_hsv(160, 100, 240) dis_centre = 10 sg.set_font("Arial", 20) sg.draw_text(300, 100, 600, 100, "2019 Desktop Product Share") sg.set_font("Arial", 10) sg.draw_text(300, 150, 600, 100, "- A Professional Survey") current_angle = 0 for key, value in data.items(): sg.set_pen_width(1) sg.set_pen_color(0, 0, 0) middle_angle = (current_angle + current_angle + 360 * value) / 2.0 sg.set_brush_color(random.randrange(100, 255), 180,