Esempio n. 1
0
def design_02():
    # set pen 
    sg.set_pen_color(0,0,0)
    sg.set_pen_style('SolidLine')
    
    # set brush 
    sg.set_brush_style('SolidPattern')
    
    # define points
    away_dist = 350
    points = [(-114,0+away_dist),(-100,40+away_dist),(-20,60+away_dist),(0,100+away_dist),(0,100+away_dist),(20,60+away_dist),(100,40+away_dist),(114,0+away_dist)]
    inner_away_dist = 330
    inner_points = [(-114,10+inner_away_dist),(-100,40+inner_away_dist),(-20,60+inner_away_dist),(0,90+inner_away_dist),(0,90+inner_away_dist),(20,60+inner_away_dist),(100,40+inner_away_dist),(114,10+inner_away_dist)]
    
    # run loop to draw
    num = 10
    for i in range(num):
        # most outer path
        sg.rotate_origin(360/num)
        sg.set_pen_width(4)
        sg.draw_path(points)
        # another path
        sg.set_pen_width(2)
        sg.draw_path(inner_points)
        # dot
        sg.set_pen_width(30)
        sg.draw_point(0,370)
        
    # fill the center with white color
    sg.set_pen_style("NoPen")
    sg.draw_circle(0,0,368)
Esempio n. 2
0
def random_circles():
    sg.set_brush_style("NoBrush")
    sg.set_pen_width(1)
    for i in range(20):
        x = random.uniform(0, w)
        y = random.uniform(0, h)
        sg.draw_circle(x, y, random.uniform(10, 500))
Esempio n. 3
0
def design_03():
    sg.set_pen_style('SolidLine')
    sg.set_pen_width(5)
    sg.draw_circle(0,0,368)
    sg.set_pen_width(1)
    num = 200
    for i in range(num):
        sg.rotate_origin(360/num)
        sg.draw_line(0,0,368,0)
    sg.set_pen_width(3)
    sg.draw_circle(0,0,340)
def draw_many_circles(num):
    sg.set_pen_style('NoPen')
    for i in range(num):
        width = random.randint(0, 200)
        x = random.randint(0, w)
        y = random.randint(0, h)
        sg.set_brush_style_linear_gradient(x - width / 2, y, x + width / 2, y,
                                           255, (num - i) / num * 200,
                                           (num - i) / num * 200, 255, 255,
                                           255)
        sg.draw_circle(x, y, width / 2)
Esempio n. 5
0
def design_05():
    sg.set_pen_width(2)
    sg.set_pen_style('SolidLine')
    sg.set_pen_color(0,0,0)
    sg.draw_circle(0,0,240)
    sg.draw_circle(0,0,235)
    sg.draw_circle(0,0,215)
    sg.draw_circle(0,0,200)
    num = 200
    sg.set_pen_width(4)
    for i in range(num):
        sg.draw_point(0,207)
        sg.rotate_origin(360/num)
    sg.set_pen_width(5)
    sg.draw_circle(0,0,180)
def draw_human(x, y):
    sg.set_pen_color(10, 10, 10)
    sg.set_pen_style('SolidLine')
    sg.set_brush_style('SolidPattern')
    sg.set_brush_color(10, 10, 10)
    # head
    sg.draw_circle(x, y + 100, 10)
    # body
    pts = [(x, y + 95), (x - 30, y + 30), (x + 10, y + 30)]
    sg.draw_polygon(pts)
    # arms and legs
    sg.set_pen_width(5)
    sg.draw_line(x + 5, y + 30, x + 5, y)
    sg.draw_line(x - 5, y + 30, x - 8, y)
    sg.set_pen_width(4)
    linepts = [(x, y + 85), (x + 20, y + 90), (x + 30, y + 110)]
    sg.draw_polyline(linepts)
    sg.draw_line(x, y + 80, x + 40, y + 85)
Esempio n. 7
0
def circle_stack(x, y, max_radius, num_of_circles, right_center):
    sg.set_brush_color(random.randrange(100, 255), 200, 200)
    sg.set_pen_color(0, 0, 0)
    pen_width = 2
    sg.set_pen_width(pen_width)
    #draw the bg circle
    if right_center:
        sg.draw_circle(x - max_radius - pen_width, y, max_radius)
    else:
        sg.draw_circle(x + max_radius + pen_width, y, max_radius)

    # draw all the on-top circles with no filling color
    sg.set_brush_color(0, 0, 0, 0)
    for i in range(num_of_circles):
        radius = max_radius * random.uniform(0, 1)
        if right_center:
            sg.draw_circle(x - radius - pen_width, y, radius)
        else:
            sg.draw_circle(x + radius + pen_width, y, radius)
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()
Esempio n. 9
0
def design_04():
    num = 20
    # most outer layer
    sg.set_pen_width(2)
    sg.set_brush_color(0,0,0)
    sg.set_brush_style('SolidPattern')
    for i in range(num):
        sg.rotate_origin(360/num)
        sg.draw_ellipse(260,0,150,15)
    sg.set_brush_style('NoBrush')
    sg.rotate_origin(360/num/2)
    
    for i in range(num):
        sg.set_pen_width(2)
        sg.rotate_origin(360/num)
        sg.draw_circle(0,280,40)
        sg.draw_circle(0,280,30)
        sg.set_pen_width(40)
        sg.draw_point(0,280)
        
    # middle layer
    sg.set_brush_style('SolidPattern')
    sg.set_brush_color(255,255,255)
    sg.rotate_origin(360/num/2)
    for i in range(num):
        sg.set_pen_width(2)
        sg.rotate_origin(360/num)
        sg.draw_circle(0,255,37)
        sg.draw_circle(0,255,27)
        sg.set_pen_width(30)
        sg.draw_point(0,255)
        
    # inner layer
    sg.set_brush_style('SolidPattern')
    sg.set_brush_color(255,255,255)
    sg.rotate_origin(360/num/2)
    for i in range(num):
        sg.set_pen_width(2)
        sg.rotate_origin(360/num)
        sg.draw_circle(0,230,37)
        sg.draw_circle(0,230,27)
        
    # cover center
    sg.set_pen_style('NoPen')
    sg.set_brush_color(255,255,255)
    sg.draw_circle(0,0,230)
Esempio n. 10
0
# draw the squares
sg.translate_origin(w / 2, h / 2)
set_gradient_for_squares()
sg.set_pen_width(0)
sg.rotate_origin(45)

for m in range(-20, 21):
    for n in range(-20, 21):
        x = m * box_dist
        y = n * box_dist
        d = distance(x, y, 0, 0)
        nsize = fit_range(d, 0, 500, 50, 0)
        #sg.draw_rect(x,y,nsize,nsize)
        sg.set_brush_style_radial_gradient(x, y, 50)
        sg.draw_circle(x, y, nsize)
sg.reset_origin()

# bg layer 2
sg.set_pen_color(255, 255, 255, 100)
layer_lines()

# draw the title
sg.set_font_size(font_size)
for i in range(len(title)):
    y = h / 2 + ((len(title) - 1) / 2 - i) * char_dist
    x = w / 2
    sg.set_pen_color(255, 255, 255, 50)
    for j in range(9):
        offset_x = random.uniform(-10, 10)
        offset_y = random.uniform(-5, 5)
h = 1000

circles = []

for i in range(20):
    circles.append((random.uniform(0,w),random.uniform(0,h),random.uniform(30,180)))

# create windows
sg.create_canvas(w,h)

# draw thicker black background circles
for item in circles:
    sg.set_brush_color(255,255,255,0)
    sg.set_pen_color(0,0,0)
    sg.set_pen_width(9*2)
    sg.draw_circle(item[0],item[1],item[2])


# draw thicker white background circles    
for item in circles:
    sg.set_pen_color(255,255,255)
    sg.set_pen_width(3*2)
    sg.draw_circle(item[0],item[1],item[2])
    
sg.set_pen_style('NoPen')
sg.set_brush_color(0,200,150,220)
sg.draw_rect_with_rot_bl(0,350,w,150,0)

sg.set_pen_color(255,255,255)
sg.set_pen_style('SolidLine')
sg.set_font_size(44)
Esempio n. 12
0
def draw_panda_gradient(x, y):
    sg.set_pen_style('NoPen')
    # ears
    sg.set_brush_style_radial_gradient(x - 50, y + 95, 40, 120, 120, 120, 0, 0,
                                       0)
    sg.draw_circle(x - 50, y + 75, 25)
    sg.set_brush_style_radial_gradient(x + 50, y + 95, 40, 120, 120, 120, 0, 0,
                                       0)
    sg.draw_circle(x + 50, y + 75, 25)
    # face
    sg.set_brush_style_radial_gradient(x, y + 70, 180, 255, 255, 255, 150, 150,
                                       150)
    sg.draw_circle(x, y, 75)
    # eyes
    sg.set_brush_color(0, 0, 0)
    sg.set_brush_style('SolidPattern')
    sg.draw_ellipse_with_rot(x - 30, y - 10, 50, 30, -60)
    sg.draw_ellipse_with_rot(x + 30, y - 10, 50, 30, 60)
    sg.set_brush_color(255, 255, 255)
    sg.draw_circle(x - 25, y - 5, 5)
    sg.draw_circle(x + 25, y - 5, 5)
    sg.set_brush_style_radial_gradient(x - 27, y - 3, 3, 200, 200, 200, 0, 0,
                                       0)
    sg.draw_circle(x - 25, y - 5, 4)
    sg.set_brush_style_radial_gradient(x + 23, y - 3, 3, 200, 200, 200, 0, 0,
                                       0)
    sg.draw_circle(x + 25, y - 5, 4)
    # nose
    sg.set_brush_style_radial_gradient(x - 3, y - 12, 7, 200, 200, 200, 0, 0,
                                       0)
    sg.draw_ellipse(x, y - 15, 20, 15)
    # mouth
    sg.set_pen_style('SolidLine')
    sg.set_pen_color(0, 0, 0)
    sg.set_pen_width(2)
    sg.draw_line(x, y - 20, x, y - 40)
    sg.draw_elliptical_arc(x, y - 30, 20, 10, 180, 180)