Ejemplo n.º 1
0
def picture_wall2():
    wall1 = GPolygon()
    wall1.add_vertex((300, 0))
    wall1.add_vertex((350, 75))
    wall1.add_vertex((440, 100))
    wall1.add_vertex((410, 180))
    wall1.add_vertex((440, 220))
    wall1.add_vertex((460, 280))
    wall1.add_vertex((470, 340))
    wall1.add_vertex((463, 400))
    wall1.add_vertex((473, 430))
    wall1.add_vertex((453, 470))
    wall1.add_vertex((432, 520))
    wall1.add_vertex((420, 550))
    wall1.add_vertex((310, 635))
    wall1.add_vertex((335, 635))
    wall1.add_vertex((443, 550))
    wall1.add_vertex((455, 520))
    wall1.add_vertex((473, 470))
    wall1.add_vertex((495, 430))
    wall1.add_vertex((482, 400))
    wall1.add_vertex((492, 340))
    wall1.add_vertex((480, 280))
    wall1.add_vertex((464, 220))
    wall1.add_vertex((435, 180))
    wall1.add_vertex((450, 100))
    wall1.add_vertex((375, 75))
    wall1.add_vertex((300, 0))
    wall1.filled = True
    wall1.fill_color = 'gray'
    wall1.color = 'gray'
    return wall1
Ejemplo n.º 2
0
def build_karel1():
    """
    This function builds the first karel
    """
    head = GOval(80, 55, x=190, y=167)
    head.filled = True
    head.color = 'black'
    head.fill_color = 'gray'
    window.add(head)
    r_eye = GRect(13, 13, x=212, y=189)
    r_eye.filled = True
    r_eye.color = 'black'
    r_eye.fill_color = 'blue'
    window.add(r_eye)
    l_eye = GRect(13, 13, x=235, y=189)
    l_eye.filled = True
    l_eye.color = 'black'
    l_eye.fill_color = 'blue'
    window.add(l_eye)
    r_eyeb = GLine(212, 185, 225, 185)
    window.add(r_eyeb)
    l_eyeb = GLine(235, 185, 248, 185)
    window.add(l_eyeb)
    hands = GRect(105, 45, x=177, y=237)
    hands.filled = True
    hands.color = 'black'
    hands.fill_color = 'lime'
    window.add(hands)
    body_1 = GRect(60, 65, x=201, y=223)
    body_1.filled = True
    body_1.color = 'black'
    body_1.fill_color = 'blue'
    window.add(body_1)
    body_2 = GRect(80, 60, x=190, y=230)
    body_2.filled = True
    body_2.color = 'black'
    body_2.fill_color = 'blue'
    window.add(body_2)
    r_foot = GOval(29, 24, x=190, y=290)
    r_foot.filled = True
    r_foot.color = 'black'
    r_foot.fill_color = 'red'
    window.add(r_foot)
    l_foot = GOval(29, 24, x=241, y=290)
    l_foot.filled = True
    l_foot.color = 'black'
    l_foot.fill_color = 'red'
    window.add(l_foot)
    label = GPolygon()
    label.add_vertex((230, 130))
    label.add_vertex((218, 150))
    label.add_vertex((242, 150))
    label.filled = True
    label.fill_color = 'firebrick'
    label.color = 'firebrick'
    window.add(label)
Ejemplo n.º 3
0
def nobita_handcloth():
    hand_cloth = GPolygon()
    hand_cloth.add_vertex((310, 555))
    hand_cloth.add_vertex((385, 505))
    hand_cloth.add_vertex((385, 585))
    hand_cloth.add_vertex((310, 635))
    hand_cloth.filled = True
    hand_cloth.fill_color = 'yellow'
    hand_cloth.color = 'yellow'
    return hand_cloth
Ejemplo n.º 4
0
def nobita_hand():
    hand = GPolygon()
    hand.add_vertex((200, 475))
    hand.add_vertex((310, 555))
    hand.add_vertex((310, 635))
    hand.add_vertex((200, 555))
    hand.filled = True
    hand.fill_color = 'antiquewhite'
    hand.color = 'antiquewhite'
    return hand
Ejemplo n.º 5
0
def rescue_light():
    #color database
    light_color = ["dimgrey", "lightgrey", "gainsboro", "whitesmoke"]

    light_beam = GPolygon()
    light_beam.color = "darkgrey"
    polygon_helper(light_beam, "darkgrey", (920, 350), (1300, 650), (1255, 250))
    bat_icon_background = GOval(385, 300, x = 870, y = 100)
    bat_icon_background.color = "darkgrey"
    obj_fill_color_add(bat_icon_background, "darkgrey")
    # gradually brighten the beam
    pause(1000)
    for s in light_color:
        light_beam.color = s
        light_beam.fill_color = s
        bat_icon_background.color = s
        bat_icon_background.fill_color = s
        pause(800)
    #batman icon in light
    bat_icon = GImage("batman.jpeg")
    window.add(bat_icon, bat_icon_background.x + 60, bat_icon_background.y + 45)
Ejemplo n.º 6
0
    def link_point(self, point):
        """
        link the point of pose list and make GObject.
        :param point: Every piece of bird is consist of GPolygon shape, which is make up by these points.
        """
        r = [random.randint(225, 255), random.randint(240, 255), random.randint(255, 255)]
        shape = GPolygon()
        shape.color = 'lightgray'
        shape.filled = True
        shape.fill_color = (r[0], r[1], r[2])
        for j in range(len(point)):
            shape.add_vertex(point[j])
        window.add(shape)
        self.shape_box.append(shape)

        self.eye.filled = True
        self.eye.fill_color = 'navy'
        window.add(self.eye, 370, 210)
Ejemplo n.º 7
0
def picture_wall():
    wall1 = GPolygon()
    wall1.add_vertex((0, 0))
    wall1.add_vertex((300, 0))
    wall1.add_vertex((250, 75))
    wall1.add_vertex((180, 100))
    wall1.add_vertex((160, 180))
    wall1.add_vertex((170, 220))
    wall1.add_vertex((140, 280))
    wall1.add_vertex((230, 340))
    wall1.add_vertex((220, 400))
    wall1.add_vertex((200, 440))
    wall1.add_vertex((200, 500))
    wall1.add_vertex((220, 550))
    wall1.add_vertex((310, 635))
    wall1.add_vertex((300, 900))
    wall1.add_vertex((0, 900))
    wall1.filled = True
    wall1.fill_color = 'darkgrey'
    wall1.color = 'grey'
    return wall1
Ejemplo n.º 8
0
def picture_wall1():
    wall1 = GPolygon()
    wall1.add_vertex((600, 0))
    wall1.add_vertex((300, 0))
    wall1.add_vertex((350, 75))
    wall1.add_vertex((440, 100))
    wall1.add_vertex((410, 180))
    wall1.add_vertex((440, 220))
    wall1.add_vertex((460, 280))
    wall1.add_vertex((470, 340))
    wall1.add_vertex((463, 400))
    wall1.add_vertex((473, 430))
    wall1.add_vertex((453, 470))
    wall1.add_vertex((432, 520))
    wall1.add_vertex((420, 550))
    wall1.add_vertex((310, 635))
    wall1.add_vertex((300, 900))
    wall1.add_vertex((600, 900))
    wall1.filled = True
    wall1.fill_color = 'darkgrey'
    wall1.color = 'darkgrey'
    return wall1
Ejemplo n.º 9
0
def main():
    """
    I draw my favorite NBA player, Stephen Curry, to celebrate
    his second winning in the 3-Point Contest. In addition, I am
    extremely happy to see Curry playing on the court again after
    last year's injury.
    """
    window = GWindow(600, 800, title='Stephen Curry')

    # Background
    background = GRect(window.width, window.height)
    background.filled = True
    background.fill_color = 'royalblue'
    background.color = 'royalblue'
    window.add(background)

    # Title
    label = GLabel('STEPHEN CURRY')
    label.color = 'gold'
    label.font = 'Times New Roman-50-bold'
    window.add(label, (window.width - label.width) / 2, 100)

    # Floor
    floor = GRect(window.width, 130)
    floor.filled = True
    floor.fill_color = 'moccasin'
    floor.color = 'wheat'
    window.add(floor, 0, 670)

    # Stephen Curry
    # Shadow
    c_shadow = GOval(180, 20)
    c_shadow.filled = True
    c_shadow.fill_color = 'gray'
    c_shadow.color = 'gray'
    window.add(c_shadow, 251, 740)

    # Right Shoe
    right_shoe_bottom = GPolygon()
    right_shoe_bottom.add_vertex((320, 742))
    right_shoe_bottom.add_vertex((320, 747))
    right_shoe_bottom.add_vertex((370, 730))
    right_shoe_bottom.add_vertex((378, 728))
    right_shoe_bottom.add_vertex((380, 720))
    right_shoe_bottom.add_vertex((376, 715))
    right_shoe_bottom.filled = True
    right_shoe_bottom.fill_color = 'snow'
    right_shoe_bottom.color = 'navy'
    window.add(right_shoe_bottom)

    right_shoe_head = GOval(21, 13)
    right_shoe_head.filled = True
    right_shoe_head.fill_color = 'snow'
    right_shoe_head.color = 'navy'
    window.add(right_shoe_head, 305, 735)

    right_shoe = GPolygon()
    right_shoe.add_vertex((338, 700))
    right_shoe.add_vertex((340, 715))
    right_shoe.add_vertex((313, 735))
    right_shoe.add_vertex((310, 743))
    right_shoe.add_vertex((320, 746))
    right_shoe.add_vertex((365, 725))
    right_shoe.add_vertex((376, 715))
    right_shoe.add_vertex((362, 693))
    right_shoe.filled = True
    right_shoe.fill_color = 'snow'
    right_shoe.color = 'snow'
    window.add(right_shoe)

    shoelace1 = GPolygon()
    shoelace1.add_vertex((330, 723))
    shoelace1.add_vertex((340, 717))
    shoelace1.add_vertex((340, 709))
    shoelace1.add_vertex((337, 717))
    shoelace1.filled = True
    shoelace1.fill_color = 'navy'
    shoelace1.color = 'navy'
    window.add(shoelace1)

    r_shoe_line1 = GLine(x0=327, x1=328, y0=733, y1=737)
    r_shoe_line1.color = 'navy'
    window.add(r_shoe_line1)

    r_shoe_line2 = GLine(x0=330, x1=334, y0=730, y1=735)
    r_shoe_line2.color = 'navy'
    window.add(r_shoe_line2)

    r_shoe_detail1 = GLine(x0=307, x1=321, y0=746, y1=743)
    r_shoe_detail1.color = 'navy'
    window.add(r_shoe_detail1)

    r_shoe_detail2 = GLine(x0=321, x1=379, y0=743, y1=719)
    r_shoe_detail2.color = 'navy'
    window.add(r_shoe_detail2)

    r_shoe_detail3 = GPolygon()
    r_shoe_detail3.add_vertex((353, 705))
    r_shoe_detail3.add_vertex((355, 708))
    r_shoe_detail3.add_vertex((357, 716))
    r_shoe_detail3.filled = True
    r_shoe_detail3.fill_color = 'navy'
    r_shoe_detail3.color = 'navy'
    window.add(r_shoe_detail3)

    r_shoe_detail4 = GPolygon()
    r_shoe_detail4.add_vertex((356, 701))
    r_shoe_detail4.add_vertex((358, 704))
    r_shoe_detail4.add_vertex((359, 710))
    r_shoe_detail4.filled = True
    r_shoe_detail4.fill_color = 'navy'
    r_shoe_detail4.color = 'navy'
    window.add(r_shoe_detail4)

    r_shoe_detail5 = GLine(x0=315, x1=338, y0=744, y1=732)
    r_shoe_detail5.color = 'navy'
    window.add(r_shoe_detail5)

    r_shoe_detail6 = GLine(x0=338, x1=361, y0=732, y1=718)
    r_shoe_detail6.color = 'navy'
    window.add(r_shoe_detail6)

    r_shoe_detail7 = GLine(x0=361, x1=374, y0=718, y1=714)
    r_shoe_detail7.color = 'navy'
    window.add(r_shoe_detail7)

    r_outline1 = GLine(x0=338, x1=340, y0=700, y1=715)
    r_outline1.color = 'navy'
    window.add(r_outline1)

    r_outline2 = GLine(x0=340, x1=313, y0=715, y1=735)
    r_outline2.color = 'navy'
    window.add(r_outline2)

    r_outline3 = GLine(x0=376, x1=362, y0=716, y1=693)
    r_outline3.color = 'navy'
    window.add(r_outline3)

    # Right Leg
    right_ankle = GPolygon()
    right_ankle.add_vertex((338, 700))
    right_ankle.add_vertex((362, 693))
    right_ankle.add_vertex((353, 680))
    right_ankle.add_vertex((344, 662))
    right_ankle.add_vertex((321, 672))
    right_ankle.add_vertex((335, 688))
    right_ankle.filled = True
    right_ankle.fill_color = 'snow'
    right_ankle.color = 'navy'
    window.add(right_ankle)

    r_sock1 = GLine(x0=327, x1=333, y0=674, y1=681)
    r_sock1.color = 'navy'
    window.add(r_sock1)

    r_sock2 = GLine(x0=330, x1=335, y0=673, y1=679)
    r_sock2.color = 'navy'
    window.add(r_sock2)

    r_sock3 = GLine(x0=333, x1=340, y0=672, y1=680)
    r_sock3.color = 'navy'
    window.add(r_sock3)

    r_protect = GPolygon()
    r_protect.add_vertex((337, 701))
    r_protect.add_vertex((335, 693))
    r_protect.add_vertex((338, 686))
    r_protect.add_vertex((355, 680))
    r_protect.add_vertex((362, 692))
    r_protect.filled = True
    r_protect.fill_color = 'snow'
    r_protect.color = 'navy'
    window.add(r_protect)

    right_calf = GPolygon()
    right_calf.add_vertex((322, 672))
    right_calf.add_vertex((343, 662))
    right_calf.add_vertex((338, 648))
    right_calf.add_vertex((313, 660))
    right_calf.filled = True
    right_calf.fill_color = 'peru'
    right_calf.color = 'navy'
    window.add(right_calf)

    right_thigh = GPolygon()
    right_thigh.add_vertex((280, 596))
    right_thigh.add_vertex((275, 615))
    right_thigh.add_vertex((300, 610))
    right_thigh.add_vertex((313, 610))
    right_thigh.add_vertex((313, 598))
    right_thigh.filled = True
    right_thigh.fill_color = 'navy'
    right_thigh.color = 'navy'
    window.add(right_thigh)

    right_knee = GPolygon()
    right_knee.add_vertex((275, 615))
    right_knee.add_vertex((273, 625))
    right_knee.add_vertex((275, 630))
    right_knee.add_vertex((287, 643))
    right_knee.add_vertex((297, 645))
    right_knee.add_vertex((313, 660))
    right_knee.add_vertex((338, 648))
    right_knee.add_vertex((334, 640))
    right_knee.add_vertex((314, 618))
    right_knee.add_vertex((313, 611))
    right_knee.add_vertex((300, 610))
    right_knee.filled = True
    right_knee.fill_color = 'snow'
    right_knee.color = 'navy'
    window.add(right_knee)

    r_knee_line1 = GPolygon()
    r_knee_line1.add_vertex((290, 629))
    r_knee_line1.add_vertex((297, 627))
    r_knee_line1.add_vertex((308, 621))
    r_knee_line1.filled = True
    r_knee_line1.fill_color = 'navy'
    r_knee_line1.color = 'navy'
    window.add(r_knee_line1)

    r_knee_line2 = GPolygon()
    r_knee_line2.add_vertex((294, 623))
    r_knee_line2.add_vertex((302, 621))
    r_knee_line2.add_vertex((306, 619))
    r_knee_line2.filled = True
    r_knee_line2.fill_color = 'navy'
    r_knee_line2.color = 'navy'
    window.add(r_knee_line2)

    r_knee_line3 = GPolygon()
    r_knee_line3.add_vertex((299, 632))
    r_knee_line3.add_vertex((308, 627))
    r_knee_line3.add_vertex((309, 625))
    r_knee_line3.filled = True
    r_knee_line3.fill_color = 'navy'
    r_knee_line3.color = 'navy'
    window.add(r_knee_line3)

    r_knee_line4 = GPolygon()
    r_knee_line4.add_vertex((316, 654))
    r_knee_line4.add_vertex((322, 650))
    r_knee_line4.add_vertex((330, 647))
    r_knee_line4.filled = True
    r_knee_line4.fill_color = 'navy'
    r_knee_line4.color = 'navy'
    window.add(r_knee_line4)

    # Left Shoe
    left_shoe_head = GOval(28, 15)
    left_shoe_head.filled = True
    left_shoe_head.fill_color = 'snow'
    left_shoe_head.color = 'navy'
    window.add(left_shoe_head, 176, 737)

    left_shoe = GPolygon()
    left_shoe.add_vertex((195, 752))
    left_shoe.add_vertex((253, 752))
    left_shoe.add_vertex((261, 750))
    left_shoe.add_vertex((256, 730))
    left_shoe.add_vertex((258, 715))
    left_shoe.add_vertex((236, 716))
    left_shoe.add_vertex((233, 712))
    left_shoe.add_vertex((217, 727))
    left_shoe.add_vertex((185, 738))
    left_shoe.add_vertex((180, 745))
    left_shoe.filled = True
    left_shoe.fill_color = 'snow'
    left_shoe.color = 'snow'
    window.add(left_shoe)

    shoelace = GPolygon()
    shoelace.add_vertex((205, 733))
    shoelace.add_vertex((209, 738))
    shoelace.add_vertex((209, 732))
    shoelace.add_vertex((216, 736))
    shoelace.add_vertex((215, 728))
    shoelace.add_vertex((223, 732))
    shoelace.add_vertex((222, 723))
    shoelace.add_vertex((230, 730))
    shoelace.add_vertex((225, 719))
    shoelace.add_vertex((233, 721))
    shoelace.add_vertex((230, 717))
    shoelace.filled = True
    shoelace.fill_color = 'snow'
    shoelace.color = 'navy'
    window.add(shoelace)

    l_shoe_line1 = GPolygon()
    l_shoe_line1.add_vertex((247, 720))
    l_shoe_line1.add_vertex((243, 727))
    l_shoe_line1.add_vertex((245, 725))
    l_shoe_line1.filled = True
    l_shoe_line1.fill_color = 'navy'
    l_shoe_line1.color = 'navy'
    window.add(l_shoe_line1)

    l_shoe_line2 = GLine(x0=251, x1=250, y0=720, y1=724)
    l_shoe_line2.color = 'navy'
    window.add(l_shoe_line2)

    l_shoe_detail1 = GLine(x0=233, x1=230, y0=718, y1=730)
    l_shoe_detail1.color = 'navy'
    window.add(l_shoe_detail1)

    l_shoe_detail2 = GLine(x0=231, x1=205, y0=730, y1=739)
    l_shoe_detail2.color = 'navy'
    window.add(l_shoe_detail2)

    l_shoe_detail3 = GLine(x0=176, x1=191, y0=745, y1=749)
    l_shoe_detail3.color = 'navy'
    window.add(l_shoe_detail3)

    l_shoe_detail4 = GLine(x0=191, x1=259, y0=749, y1=745)
    l_shoe_detail4.color = 'navy'
    window.add(l_shoe_detail4)

    l_shoe_detail5 = GLine(x0=185, x1=191, y0=747, y1=744)
    l_shoe_detail5.color = 'navy'
    window.add(l_shoe_detail5)

    l_shoe_detail6 = GLine(x0=191, x1=202, y0=744, y1=745)
    l_shoe_detail6.color = 'navy'
    window.add(l_shoe_detail6)

    l_shoe_detail7 = GLine(x0=202, x1=243, y0=745, y1=736)
    l_shoe_detail7.color = 'navy'
    window.add(l_shoe_detail7)

    l_shoe_detail8 = GLine(x0=243, x1=258, y0=736, y1=738)
    l_shoe_detail8.color = 'navy'
    window.add(l_shoe_detail8)

    l_outline1 = GLine(x0=194, x1=250, y0=752, y1=752)
    l_outline1.color = 'navy'
    window.add(l_outline1)

    l_outline2 = GLine(x0=250, x1=261, y0=752, y1=750)
    l_outline2.color = 'navy'
    window.add(l_outline2)

    l_outline3 = GLine(x0=261, x1=256, y0=750, y1=730)
    l_outline3.color = 'navy'
    window.add(l_outline3)

    l_outline4 = GLine(x0=256, x1=258, y0=730, y1=715)
    l_outline4.color = 'navy'
    window.add(l_outline4)

    l_outline5 = GLine(x0=233, x1=217, y0=712, y1=727)
    l_outline5.color = 'navy'
    window.add(l_outline5)

    l_outline6 = GLine(x0=217, x1=184, y0=727, y1=738)
    l_outline6.color = 'navy'
    window.add(l_outline6)

    # Left Leg
    left_ankle = GPolygon()
    left_ankle.add_vertex((233, 712))
    left_ankle.add_vertex((236, 716))
    left_ankle.add_vertex((258, 715))
    left_ankle.add_vertex((260, 697))
    left_ankle.add_vertex((264, 679))
    left_ankle.add_vertex((237, 677))
    left_ankle.add_vertex((237, 697))
    left_ankle.filled = True
    left_ankle.fill_color = 'snow'
    left_ankle.color = 'navy'
    window.add(left_ankle)

    l_protect = GPolygon()
    l_protect.add_vertex((233, 712))
    l_protect.add_vertex((234, 698))
    l_protect.add_vertex((244, 699))
    l_protect.add_vertex((261, 702))
    l_protect.add_vertex((260, 713))
    l_protect.add_vertex((243, 716))
    l_protect.filled = True
    l_protect.fill_color = 'snow'
    l_protect.color = 'navy'
    window.add(l_protect)

    l_sock1 = GLine(x0=252, x1=252, y0=687, y1=695)
    l_sock1.color = 'navy'
    window.add(l_sock1)

    l_sock2 = GLine(x0=255, x1=254, y0=685, y1=695)
    l_sock2.color = 'navy'
    window.add(l_sock2)

    l_sock3 = GLine(x0=259, x1=257, y0=683, y1=695)
    l_sock3.color = 'navy'
    window.add(l_sock3)

    left_calf1 = GPolygon()
    left_calf1.add_vertex((238, 677))
    left_calf1.add_vertex((263, 679))
    left_calf1.add_vertex((267, 662))
    left_calf1.add_vertex((236, 660))
    left_calf1.filled = True
    left_calf1.fill_color = 'peru'
    left_calf1.color = 'navy'
    window.add(left_calf1)

    lef_calf2 = GPolygon()
    lef_calf2.add_vertex((235, 660))
    lef_calf2.add_vertex((268, 662))
    lef_calf2.add_vertex((269, 650))
    lef_calf2.add_vertex((268, 620))
    lef_calf2.add_vertex((272, 613))
    lef_calf2.add_vertex((233, 608))
    lef_calf2.add_vertex((232, 620))
    lef_calf2.add_vertex((237, 640))
    lef_calf2.filled = True
    lef_calf2.fill_color = 'snow'
    lef_calf2.color = 'navy'
    window.add(lef_calf2)

    l_knee_line1 = GPolygon()
    l_knee_line1.add_vertex((242, 615))
    l_knee_line1.add_vertex((250, 617))
    l_knee_line1.add_vertex((261, 618))
    l_knee_line1.filled = True
    l_knee_line1.fill_color = 'navy'
    l_knee_line1.color = 'navy'
    window.add(l_knee_line1)

    l_knee_line2 = GPolygon()
    l_knee_line2.add_vertex((245, 621))
    l_knee_line2.add_vertex((248, 622))
    l_knee_line2.add_vertex((260, 622))
    l_knee_line2.filled = True
    l_knee_line2.fill_color = 'navy'
    l_knee_line2.color = 'navy'
    window.add(l_knee_line2)

    l_knee_line3 = GPolygon()
    l_knee_line3.add_vertex((249, 626))
    l_knee_line3.add_vertex((252, 627))
    l_knee_line3.add_vertex((259, 626))
    l_knee_line3.filled = True
    l_knee_line3.fill_color = 'navy'
    l_knee_line3.color = 'navy'
    window.add(l_knee_line3)

    l_knee_line4 = GPolygon()
    l_knee_line4.add_vertex((243, 656))
    l_knee_line4.add_vertex((249, 657))
    l_knee_line4.add_vertex((263, 658))
    l_knee_line4.filled = True
    l_knee_line4.fill_color = 'navy'
    l_knee_line4.color = 'navy'
    window.add(l_knee_line4)

    left_thigh = GPolygon()
    left_thigh.add_vertex((233, 608))
    left_thigh.add_vertex((272, 613))
    left_thigh.add_vertex((277, 598))
    left_thigh.add_vertex((237, 593))
    left_thigh.filled = True
    left_thigh.fill_color = 'navy'
    left_thigh.color = 'navy'
    window.add(left_thigh)

    # Shorts
    shorts = GPolygon()
    shorts.add_vertex((227, 590))
    shorts.add_vertex((290, 598))
    shorts.add_vertex((291, 596))
    shorts.add_vertex((322, 596))
    shorts.add_vertex((321, 560))
    shorts.add_vertex((324, 540))
    shorts.add_vertex((330, 520))
    shorts.add_vertex((328, 475))
    shorts.add_vertex((252, 478))
    shorts.add_vertex((240, 515))
    shorts.add_vertex((230, 580))
    shorts.filled = True
    shorts.fill_color = 'snow'
    shorts.color = 'navy'
    window.add(shorts)

    line_1 = GPolygon()
    line_1.add_vertex((252, 505))
    line_1.add_vertex((259, 485))
    line_1.add_vertex((255, 495))
    line_1.filled = True
    line_1.fill_color = 'navy'
    line_1.color = 'navy'
    window.add(line_1)

    line_2 = GPolygon()
    line_2.add_vertex((263, 495))
    line_2.add_vertex((254, 525))
    line_2.add_vertex((257, 513))
    line_2.filled = True
    line_2.fill_color = 'navy'
    line_2.color = 'navy'
    window.add(line_2)

    line_3 = GPolygon()
    line_3.add_vertex((302, 485))
    line_3.add_vertex((294, 525))
    line_3.add_vertex((299, 504))
    line_3.filled = True
    line_3.fill_color = 'navy'
    line_3.color = 'navy'
    window.add(line_3)

    line_4 = GPolygon()
    line_4.add_vertex((307, 502))
    line_4.add_vertex((299, 538))
    line_4.add_vertex((304, 519))
    line_4.filled = True
    line_4.fill_color = 'navy'
    line_4.color = 'navy'
    window.add(line_4)

    stripe3 = GPolygon()
    stripe3.add_vertex((275, 478))
    stripe3.add_vertex((263, 530))
    stripe3.add_vertex((246, 592))
    stripe3.add_vertex((253, 593))
    stripe3.add_vertex((283, 478))
    stripe3.filled = True
    stripe3.fill_color = 'gold'
    stripe3.color = 'navy'
    window.add(stripe3)
    stripe4 = GPolygon()
    stripe4.add_vertex((289, 478))
    stripe4.add_vertex((260, 593))
    stripe4.add_vertex((267, 595))
    stripe4.add_vertex((295, 478))
    stripe4.filled = True
    stripe4.fill_color = 'gold'
    stripe4.color = 'navy'
    window.add(stripe4)

    pattern1 = GPolygon()
    pattern1.add_vertex((227, 590))
    pattern1.add_vertex((290, 598))
    pattern1.add_vertex((293, 590))
    pattern1.add_vertex((286, 565))
    pattern1.add_vertex((283, 550))
    pattern1.add_vertex((282, 537))
    pattern1.add_vertex((270, 587))
    pattern1.add_vertex((248, 583))
    pattern1.add_vertex((262, 533))
    pattern1.add_vertex((246, 555))
    pattern1.add_vertex((232, 570))
    pattern1.filled = True
    pattern1.fill_color = 'navy'
    pattern1.color = 'navy'
    window.add(pattern1)
    pattern2 = GPolygon()
    pattern2.add_vertex((292, 596))
    pattern2.add_vertex((322, 596))
    pattern2.add_vertex((321, 589))
    pattern2.add_vertex((295, 590))
    pattern2.filled = True
    pattern2.fill_color = 'navy'
    pattern2.color = 'navy'
    window.add(pattern2)

    shorts_line = GPolygon()
    shorts_line.add_vertex((291, 596))
    shorts_line.add_vertex((310, 525))
    shorts_line.add_vertex((307, 540))
    shorts_line.filled = True
    shorts_line.fill_color = 'navy'
    shorts_line.color = 'navy'
    window.add(shorts_line)

    # Right Arm
    right_arm = GPolygon()
    right_arm.add_vertex((272, 344))
    right_arm.add_vertex((237, 257))
    right_arm.add_vertex((232, 250))
    right_arm.add_vertex((215, 247))
    right_arm.add_vertex((208, 241))
    right_arm.add_vertex((208, 230))
    right_arm.add_vertex((217, 228))
    right_arm.add_vertex((203, 207))
    right_arm.add_vertex((206, 204))
    right_arm.add_vertex((223, 222))
    right_arm.add_vertex((213, 198))
    right_arm.add_vertex((216, 196))
    right_arm.add_vertex((230, 218))
    right_arm.add_vertex((223, 201))
    right_arm.add_vertex((226, 199))
    right_arm.add_vertex((245, 237))
    right_arm.add_vertex((251, 245))
    right_arm.add_vertex((300, 339))
    right_arm.filled = True
    right_arm.fill_color = 'peru'
    right_arm.color = 'navy'
    window.add(right_arm)

    right_hand = GOval(7, 6)
    right_hand.filled = True
    right_hand.fill_color = 'royalblue'
    right_hand.color = 'navy'
    window.add(right_hand, 213, 234)

    # Face
    face = GPolygon()
    face.add_vertex((283, 345))
    face.add_vertex((322, 350))
    face.add_vertex((305, 307))
    face.add_vertex((306, 290))
    face.add_vertex((270, 277))
    face.add_vertex((255, 278))
    face.add_vertex((253, 288))
    face.add_vertex((255, 298))
    face.add_vertex((251, 309))
    face.add_vertex((251, 311))
    face.add_vertex((253, 311))
    face.add_vertex((254, 316))
    face.add_vertex((260, 319))
    face.add_vertex((258, 323))
    face.add_vertex((262, 329))
    face.add_vertex((275, 326))
    face.filled = True
    face.fill_color = 'peru'
    face.color = 'navy'
    window.add(face)

    ear1 = GOval(10, 15)
    ear1.filled = True
    ear1.fill_color = 'peru'
    ear1.color = 'navy'
    window.add(ear1, 278, 288)
    ear2 = GOval(6, 10)
    ear2.filled = True
    ear2.fill_color = 'peru'
    ear2.color = 'peru'
    window.add(ear2, 277, 293)

    jaw_line1 = GLine(x0=283, x1=285, y0=303, y1=312)
    jaw_line1.color = 'navy'
    window.add(jaw_line1)
    jaw_line2 = GLine(x0=285, x1=277, y0=311, y1=320)
    jaw_line2.color = 'navy'
    window.add(jaw_line2)

    eyebrow = GLine(x0=254, x1=259, y0=296, y1=293)
    eyebrow.color = 'navy'
    window.add(eyebrow)

    beard = GPolygon()
    beard.add_vertex((259, 323))
    beard.add_vertex((260, 332))
    beard.add_vertex((263, 334))
    beard.add_vertex((270, 331))
    beard.add_vertex((272, 319))
    beard.add_vertex((262, 324))
    beard.filled = True
    beard.fill_color = 'navy'
    beard.color = 'navy'
    window.add(beard)

    # Hair
    hair = GPolygon()
    hair.add_vertex((255, 278))
    hair.add_vertex((270, 277))
    hair.add_vertex((306, 290))
    hair.add_vertex((308, 280))
    hair.add_vertex((306, 270))
    hair.add_vertex((300, 262))
    hair.add_vertex((287, 256))
    hair.add_vertex((270, 260))
    hair.add_vertex((265, 263))
    hair.add_vertex((256, 270))
    hair.filled = True
    hair.fill_color = 'navy'
    hair.color = 'navy'
    window.add(hair)

    # Jersey
    jersey = GPolygon()
    jersey.add_vertex((252, 478))
    jersey.add_vertex((331, 476))
    jersey.add_vertex((334, 392))
    jersey.add_vertex((325, 339))
    jersey.add_vertex((303, 333))
    jersey.add_vertex((272, 350))
    jersey.add_vertex((277, 334))
    jersey.add_vertex((261, 365))
    jersey.add_vertex((251, 465))
    jersey.filled = True
    jersey.fill_color = 'snow'
    jersey.color = 'navy'
    window.add(jersey)

    line1 = GPolygon()
    line1.add_vertex((286, 410))
    line1.add_vertex((269, 423))
    line1.add_vertex((277, 416))
    line1.filled = True
    line1.fill_color = 'navy'
    line1.color = 'navy'
    window.add(line1)

    line2 = GPolygon()
    line2.add_vertex((278, 426))
    line2.add_vertex((262, 439))
    line2.add_vertex((268, 433))
    line2.filled = True
    line2.fill_color = 'navy'
    line2.color = 'navy'
    window.add(line2)

    line3 = GPolygon()
    line3.add_vertex((270, 443))
    line3.add_vertex((257, 457))
    line3.add_vertex((262, 450))
    line3.filled = True
    line3.fill_color = 'navy'
    line3.color = 'navy'
    window.add(line3)

    collar = GPolygon()
    collar.add_vertex((277, 334))
    collar.add_vertex((272, 350))
    collar.add_vertex((303, 333))
    collar.add_vertex((325, 339))
    collar.add_vertex((325, 335))
    collar.add_vertex((305, 331))
    collar.add_vertex((276, 343))
    collar.filled = True
    collar.fill_color = 'navy'
    collar.color = 'navy'
    window.add(collar)

    stripe1 = GPolygon()
    stripe1.add_vertex((289, 400))
    stripe1.add_vertex((289, 440))
    stripe1.add_vertex((280, 477))
    stripe1.add_vertex((288, 477))
    stripe1.add_vertex((296, 440))
    stripe1.add_vertex((296, 400))
    stripe1.filled = True
    stripe1.fill_color = 'gold'
    stripe1.color = 'navy'
    window.add(stripe1)
    stripe2 = GPolygon()
    stripe2.add_vertex((302, 410))
    stripe2.add_vertex((302, 440))
    stripe2.add_vertex((296, 477))
    stripe2.add_vertex((304, 477))
    stripe2.add_vertex((309, 410))
    stripe2.filled = True
    stripe2.fill_color = 'gold'
    stripe2.color = 'navy'
    window.add(stripe2)

    sleeveless1 = GOval(55, 65)
    sleeveless1.filled = True
    sleeveless1.fill_color = 'navy'
    sleeveless1.color = 'navy'
    window.add(sleeveless1, 276, 340)

    sleeveless2 = GPolygon()
    sleeveless2.add_vertex((261, 365))
    sleeveless2.add_vertex((277, 334))
    sleeveless2.add_vertex((261, 363))
    sleeveless2.filled = True
    sleeveless2.fill_color = 'navy'
    sleeveless2.color = 'navy'
    window.add(sleeveless2)

    # Left Arm
    upper_arm = GOval(50, 58)
    upper_arm.filled = True
    upper_arm.fill_color = 'peru'
    upper_arm.color = 'navy'
    window.add(upper_arm, 279, 343)

    arm = GPolygon()
    arm.add_vertex((295, 380))
    arm.add_vertex((301, 410))
    arm.add_vertex((311, 440))
    arm.add_vertex((315, 460))
    arm.add_vertex((320, 478))
    arm.add_vertex((330, 520))
    arm.add_vertex((350, 518))
    arm.add_vertex((345, 496))
    arm.add_vertex((342, 476))
    arm.add_vertex((340, 435))
    arm.add_vertex((334, 405))
    arm.add_vertex((328, 385))
    arm.filled = True
    arm.fill_color = 'peru'
    arm.color = 'navy'
    window.add(arm)

    arm_line = GRect(31, 7)
    arm_line.filled = True
    arm_line.fill_color = 'peru'
    arm_line.color = 'peru'
    window.add(arm_line, 295, 380)

    wrist = GPolygon()
    wrist.add_vertex((329, 520))
    wrist.add_vertex((351, 518))
    wrist.add_vertex((351, 522))
    wrist.add_vertex((330, 524))
    wrist.filled = True
    wrist.fill_color = 'navy'
    wrist.color = 'navy'
    window.add(wrist)

    arm_pit = GPolygon()
    arm_pit.add_vertex((295, 385))
    arm_pit.add_vertex((290, 380))
    arm_pit.add_vertex((297, 394))
    arm_pit.filled = True
    arm_pit.fill_color = 'navy'
    arm_pit.color = 'navy'
    window.add(arm_pit)

    # Left Hand
    left_hand = GPolygon()
    left_hand.add_vertex((330, 524))
    left_hand.add_vertex((351, 522))
    left_hand.add_vertex((358, 536))
    left_hand.add_vertex((361, 554))
    left_hand.add_vertex((359, 556))
    left_hand.add_vertex((354, 537))
    left_hand.add_vertex((358, 563))
    left_hand.add_vertex((354, 565))
    left_hand.add_vertex((348, 540))
    left_hand.add_vertex((352, 567))
    left_hand.add_vertex((347, 567))
    left_hand.add_vertex((342, 540))
    left_hand.add_vertex((345, 566))
    left_hand.add_vertex((340, 565))
    left_hand.add_vertex((335, 541))
    left_hand.add_vertex((337, 560))
    left_hand.add_vertex((332, 556))
    left_hand.add_vertex((328, 536))
    left_hand.filled = True
    left_hand.fill_color = 'peru'
    left_hand.color = 'navy'
    window.add(left_hand)

    # Basketball shadow
    shadow = GOval(70, 20)
    shadow.filled = True
    shadow.fill_color = 'gray'
    shadow.color = 'gray'
    window.add(shadow, 478, 683)

    # Basketball
    ball = GOval(80, 80)
    ball.filled = True
    ball.fill_color = 'darkorange'
    window.add(ball, 450, 620)
    line1 = GOval(80, 60)
    line1.filled = True
    line1.fill_color = 'darkorange'
    window.add(line1, 450, 630)
    line2 = GLine(x0=450, x1=530, y0=660, y1=660)
    window.add(line2)

    # Brand Name 'SPALDING'
    brand1 = GLabel('S')
    brand1.font = 'Impact-17'
    window.add(brand1, 461, 661)
    brand2 = GLabel('P')
    brand2.font = 'Impact-15'
    window.add(brand2, 470, 658)
    brand3 = GLabel('A')
    brand3.font = 'Impact-13'
    window.add(brand3, 478, 656)
    brand4 = GLabel('L')
    brand4.font = 'Impact-13'
    window.add(brand4, 486, 656)
    brand5 = GLabel('D')
    brand5.font = 'Impact-13'
    window.add(brand5, 492, 656)
    brand6 = GLabel('I')
    brand6.font = 'Impact-13'
    window.add(brand6, 500, 656)
    brand7 = GLabel('N')
    brand7.font = 'Impact-15'
    window.add(brand7, 504, 658)
    brand8 = GLabel('G')
    brand8.font = 'Impact-17'
    window.add(brand8, 512, 661)

    # Logo
    logo1 = GOval(10, 7)
    logo1.filled = True
    logo1.fill_color = 'darkorange'
    window.add(logo1, 485, 633)
    logo2 = GLabel('S')
    logo2.font = 'Courier-7-italic'
    window.add(logo2, 488, 641)

    # NBA Logo
    frame = GRect(10, 20)
    frame.filled = True
    frame.fill_color = 'black'
    window.add(frame, 485, 664)
    nba = GLabel('NBA')
    nba.color = 'white'
    nba.font = 'Times-3-bold'
    window.add(nba, 485, 685)
    head = GOval(2, 3)
    head.filled = True
    head.fill_color = 'darkorange'
    head.color = 'darkorange'
    window.add(head, 490, 664)
    body = GPolygon()
    body.add_vertex((490, 667))
    body.add_vertex((484, 673))
    body.add_vertex((493, 685))
    body.filled = True
    body.fill_color = 'darkorange'
    body.color = 'darkorange'
    window.add(body)
    small_ball = GOval(3, 3)
    small_ball.filled = True
    small_ball.color = 'darkorange'
    small_ball.fill_color = 'darkorange'
    window.add(small_ball, 493, 674)
    arm = GLine(x0=490, x1=494, y0=667, y1=674)
    arm.color = 'darkorange'
    window.add(arm)

    # Words on the Basketball
    word1 = GLabel('GAME BALL SERIES')
    word1.font = '-2-bold'
    window.add(word1, 462, 672)
    word2 = GLabel('OUTDOOR')
    word2.font = '-1'
    window.add(word2, 470, 674)
    word3 = GLabel('Adam Silver')
    word3.font = 'Apple Chancery-4'
    window.add(word3, 498, 674)
    word4 = GLabel('COMMISSIONER')
    word4.font = '-1'
    window.add(word4, 504, 674)
Ejemplo n.º 10
0
def build_karel2():
    """
    This function builds the second karel
    """
    add = 1
    head = GOval(80, 55, x=190+120*add, y=167)
    head.filled = True
    head.color = 'black'
    head.fill_color = 'gray'
    window.add(head)
    r_eye = GRect(13, 13, x=212+120*add, y=189)
    r_eye.filled = True
    r_eye.color = 'black'
    r_eye.fill_color = 'blue'
    window.add(r_eye)
    l_eye = GRect(13, 13, x=235+120*add, y=189)
    l_eye.filled = True
    l_eye.color = 'black'
    l_eye.fill_color = 'blue'
    window.add(l_eye)
    mouth = GPolygon()
    mouth.filled = True
    mouth.fill_color = 'red'
    mouth.color = 'black'
    mouth.add_vertex((350, 205))
    mouth.add_vertex((353, 211))
    mouth.add_vertex((347, 211))
    window.add(mouth)
    hands = GRect(105, 45, x=177+120*add, y=237)
    hands.filled = True
    hands.color = 'black'
    hands.fill_color = 'lime'
    window.add(hands)
    body_1 = GRect(60, 65, x=201+120*add, y=223)
    body_1.filled = True
    body_1.color = 'black'
    body_1.fill_color = 'blue'
    window.add(body_1)
    body_2 = GRect(80, 60, x=190+120*add, y=230)
    body_2.filled = True
    body_2.color = 'black'
    body_2.fill_color = 'blue'
    window.add(body_2)
    r_foot = GOval(29, 24, x=190+120*add, y=290)
    r_foot.filled = True
    r_foot.color = 'black'
    r_foot.fill_color = 'red'
    window.add(r_foot)
    l_foot = GOval(29, 24, x=241+120*add, y=290)
    l_foot.filled = True
    l_foot.color = 'black'
    l_foot.fill_color = 'red'
    window.add(l_foot)
    label1 = GPolygon()
    label1.add_vertex((230+120*add, 128))
    label1.add_vertex((218+120*add, 140))
    label1.add_vertex((242+120*add, 140))
    label1.filled = True
    label1.fill_color = 'steelblue'
    label1.color = 'steelblue'
    window.add(label1)
    label2 = GPolygon()
    label2.add_vertex((230 + 120 * add, 152))
    label2.add_vertex((218 + 120 * add, 140))
    label2.add_vertex((242 + 120 * add, 140))
    label2.filled = True
    label2.fill_color = 'steelblue'
    label2.color = 'steelblue'
    window.add(label2)
Ejemplo n.º 11
0
def main():
    """
    TODO:
    1.create the left side of my drawing
    2.create the right side of my drawing
    3.create the label
    """
    window = GWindow(512, 238, title="Life of π")
    # white hair
    white_hair = GRect(512, 238)
    white_hair.filled = True
    white_hair.fill_color = "moccasin"
    white_hair.color = "moccasin"
    window.add(white_hair)
    # 1.create the left side of my drawing
    # left side:
    # brown_hair,black_stripe_1~8,lower_eyelid,gold_eye,pupil,small_light,big_light,eyelid_white,eyelid_black.nose
    # brown hair
    brown_hair = GPolygon()
    brown_hair.add_vertex((0, 0))  # 1
    brown_hair.add_vertex((41, 0))
    brown_hair.add_vertex((64, 50))
    brown_hair.add_vertex((47, 84))
    brown_hair.add_vertex((60, 126))  # 5
    brown_hair.add_vertex((77, 158))
    brown_hair.add_vertex((123, 187))
    brown_hair.add_vertex((146, 212))
    brown_hair.add_vertex((183, 166))
    brown_hair.add_vertex((169, 135))  # 10
    brown_hair.add_vertex((191, 92))
    brown_hair.add_vertex((189, 41))
    brown_hair.add_vertex((162, 0))
    brown_hair.add_vertex((256, 0))
    brown_hair.add_vertex((256, 238))  # 15
    brown_hair.add_vertex((82, 238))
    brown_hair.add_vertex((40, 197))
    brown_hair.add_vertex((0, 197))  # 18
    brown_hair.filled = True
    brown_hair.fill_color = "darkorange"
    brown_hair.color = "darkorange"
    window.add(brown_hair)
    # black stripe
    # 1
    black_stripe_1 = GPolygon()
    black_stripe_1.add_vertex((0, 0))  # 1
    black_stripe_1.add_vertex((70, 0))
    black_stripe_1.add_vertex((59, 39))
    black_stripe_1.add_vertex((70, 52))
    black_stripe_1.add_vertex((59, 58))  # 5
    black_stripe_1.add_vertex((59, 80))  # 6
    black_stripe_1.add_vertex((63, 100))
    black_stripe_1.add_vertex((51, 110))
    black_stripe_1.add_vertex((28, 150))
    black_stripe_1.add_vertex((31, 103))  # 10
    black_stripe_1.add_vertex((41, 77))  # 11
    black_stripe_1.add_vertex((42, 52))
    black_stripe_1.add_vertex((20, 66))
    black_stripe_1.add_vertex((19, 107))
    black_stripe_1.add_vertex((0, 150))  # 15
    black_stripe_1.add_vertex((0, 57))
    black_stripe_1.add_vertex((32, 23))
    black_stripe_1.filled = True
    black_stripe_1.color = "black"
    window.add(black_stripe_1)
    # 2
    black_stripe_2 = GPolygon()
    black_stripe_2.add_vertex((30, 152))  # 1
    black_stripe_2.add_vertex((58, 208))
    black_stripe_2.add_vertex((83, 216))
    black_stripe_2.add_vertex((115, 208))
    black_stripe_2.add_vertex((79, 235))  # 5
    black_stripe_2.add_vertex((47, 226))  # 6
    black_stripe_2.filled = True
    black_stripe_2.color = "black"
    window.add(black_stripe_2)
    # 3
    black_stripe_3 = GPolygon()
    black_stripe_3.add_vertex((57, 165))  # 1
    black_stripe_3.add_vertex((73, 190))
    black_stripe_3.add_vertex((121, 188))
    black_stripe_3.add_vertex((85, 166))
    black_stripe_3.add_vertex((89, 178))  # 5
    black_stripe_3.filled = True
    black_stripe_3.color = "black"
    window.add(black_stripe_3)
    # 4
    black_stripe_4 = GPolygon()
    black_stripe_4.add_vertex((85, 167))  # 1
    black_stripe_4.add_vertex((60, 120))
    black_stripe_4.add_vertex((58, 146))
    black_stripe_4.filled = True
    black_stripe_4.color = "black"
    window.add(black_stripe_4)
    # 5
    black_stripe_5 = GPolygon()
    black_stripe_5.add_vertex((62, 100))  # 1
    black_stripe_5.add_vertex((102, 101))
    black_stripe_5.add_vertex((133, 112))
    black_stripe_5.add_vertex((153, 131))
    black_stripe_5.add_vertex((162, 148))  # 5
    black_stripe_5.add_vertex((170, 190))  # 6
    black_stripe_5.add_vertex((149, 212))
    black_stripe_5.add_vertex((141, 178))
    black_stripe_5.add_vertex((121, 176))
    black_stripe_5.add_vertex((101, 164))  # 10
    black_stripe_5.add_vertex((88, 146))  # 11
    black_stripe_5.add_vertex((82, 118))
    black_stripe_5.add_vertex((61, 123))
    black_stripe_5.filled = True
    black_stripe_5.color = "black"
    window.add(black_stripe_5)
    # 6
    black_stripe_6 = GPolygon()
    black_stripe_6.add_vertex((192, 0))  # 1
    black_stripe_6.add_vertex((211, 5))
    black_stripe_6.add_vertex((180, 29))
    black_stripe_6.add_vertex((162, 33))
    black_stripe_6.add_vertex((160, 55))  # 5
    black_stripe_6.add_vertex((145, 61))  # 6
    black_stripe_6.add_vertex((133, 44))
    black_stripe_6.add_vertex((124, 62))
    black_stripe_6.add_vertex((154, 120))
    black_stripe_6.add_vertex((119, 100))  # 10
    black_stripe_6.add_vertex((99, 80))  # 11
    black_stripe_6.add_vertex((71, 67))
    black_stripe_6.add_vertex((92, 65))
    black_stripe_6.add_vertex((99, 47))
    black_stripe_6.add_vertex((104, 50))  # 15
    black_stripe_6.add_vertex((99, 65))  # 16
    black_stripe_6.add_vertex((127, 91))
    black_stripe_6.add_vertex((110, 62))
    black_stripe_6.add_vertex((121, 45))
    black_stripe_6.add_vertex((120, 31))  # 20
    black_stripe_6.add_vertex((130, 18))
    black_stripe_6.add_vertex((162, 19))  # 22
    black_stripe_6.filled = True
    black_stripe_6.color = "black"
    window.add(black_stripe_6)
    # 7
    black_stripe_7 = GPolygon()
    black_stripe_7.add_vertex((256, 0))  # 1
    black_stripe_7.add_vertex((231, 20))
    black_stripe_7.add_vertex((223, 8))
    black_stripe_7.add_vertex((192, 38))
    black_stripe_7.add_vertex((181, 65))  # 5
    black_stripe_7.add_vertex((190, 96))  # 6
    black_stripe_7.add_vertex((180, 126))
    black_stripe_7.add_vertex((191, 124))
    black_stripe_7.add_vertex((195, 102))
    black_stripe_7.add_vertex((211, 89))  # 10
    black_stripe_7.add_vertex((203, 81))  # 11
    black_stripe_7.add_vertex((199, 52))
    black_stripe_7.add_vertex((200, 43))
    black_stripe_7.add_vertex((222, 31))
    black_stripe_7.add_vertex((231, 56))  # 15
    black_stripe_7.add_vertex((225, 76))  # 16
    black_stripe_7.add_vertex((215, 89))
    black_stripe_7.add_vertex((226, 94))
    black_stripe_7.add_vertex((241, 68))
    black_stripe_7.add_vertex((250, 47))  # 20
    black_stripe_7.add_vertex((252, 81))
    black_stripe_7.add_vertex((234, 112))
    black_stripe_7.add_vertex((256, 123))  # 23
    black_stripe_7.filled = True
    black_stripe_7.color = "black"
    window.add(black_stripe_7)
    # 8
    black_stripe_8 = GPolygon()
    black_stripe_8.add_vertex((193, 126))  # 1
    black_stripe_8.add_vertex((189, 144))
    black_stripe_8.add_vertex((216, 121))
    black_stripe_8.add_vertex((225, 99))
    black_stripe_8.add_vertex((208, 117))  # 5
    black_stripe_8.filled = True
    black_stripe_8.color = "black"
    window.add(black_stripe_8)
    # lower-eyelid
    lower_eyelid = GPolygon()
    lower_eyelid.add_vertex((78, 107))  # 1
    lower_eyelid.add_vertex((84, 110))
    lower_eyelid.add_vertex((96, 150))
    lower_eyelid.add_vertex((114, 162))
    lower_eyelid.add_vertex((138, 164))  # 5
    lower_eyelid.add_vertex((154, 168))
    lower_eyelid.add_vertex((160, 150))
    lower_eyelid.add_vertex((159, 187))
    lower_eyelid.add_vertex((137, 167))
    lower_eyelid.add_vertex((114, 165))  # 10
    lower_eyelid.add_vertex((94, 153))
    lower_eyelid.add_vertex((82, 111))
    lower_eyelid.filled = True
    lower_eyelid.color = "thistle"
    lower_eyelid.fill_color = "thistle"
    window.add(lower_eyelid)
    # eye
    # eye-gold_eye
    gold_eye = GOval(52, 50, x=94, y=103)
    gold_eye.filled = True
    gold_eye.color = "gold"
    gold_eye.fill_color = "gold"
    window.add(gold_eye)
    # eye-pupil
    pupil = GOval(13, 12, x=113, y=122)
    pupil.filled = True
    pupil.fill_color = "black"
    window.add(pupil)
    # eye-small_light
    small_light = GOval(4, 4, x=124, y=124)
    small_light.filled = True
    small_light.color = "white"
    small_light.fill_color = "white"
    window.add(small_light)
    # eye-big_light
    big_light = GOval(10, 11, x=104, y=118)
    big_light.filled = True
    big_light.color = "white"
    big_light.fill_color = "white"
    window.add(big_light)
    # eyelid
    # eyelid_white
    eyelid_white = GPolygon()
    eyelid_white.add_vertex((105, 97))
    eyelid_white.add_vertex((133, 101))
    eyelid_white.add_vertex((155, 117))
    eyelid_white.add_vertex((154, 142))
    eyelid_white.add_vertex((126, 115))
    eyelid_white.add_vertex((93, 107))
    eyelid_white.filled = True
    eyelid_white.fill_color = "burlywood"
    eyelid_white.color = "burlywood"
    window.add(eyelid_white)
    # eyelid_black
    eyelid_black = GPolygon()
    eyelid_black.add_vertex((91, 100))
    eyelid_black.add_vertex((129, 108))
    eyelid_black.add_vertex((157, 132))
    eyelid_black.add_vertex((156, 147))
    eyelid_black.add_vertex((126, 120))
    eyelid_black.add_vertex((91, 111))
    eyelid_black.add_vertex((87, 104))
    eyelid_black.filled = True
    eyelid_black.fill_color = "black"
    window.add(eyelid_black)
    # nose
    nose = GPolygon()
    nose.add_vertex((256, 170))
    nose.add_vertex((256, 238))
    nose.add_vertex((163, 238))
    nose.filled = True
    nose.fill_color = "chocolate"
    nose.color = "chocolate"
    window.add(nose)
    # 2.create the right side of my drawing
    # right side:
    # brown_hair,black_stripe_1~8,lower_eyelid,gold_eye,pupil,small_light,big_light,eyelid_white,eyelid_black,nose
    # brown hair
    brown_hair = GPolygon()
    brown_hair.add_vertex((window.width-1-0, 0))  # 1
    brown_hair.add_vertex((window.width-1-41, 0))
    brown_hair.add_vertex((window.width-1-64, 50))
    brown_hair.add_vertex((window.width-1-47, 84))
    brown_hair.add_vertex((window.width-1-60, 126))  # 5
    brown_hair.add_vertex((window.width-1-77, 158))
    brown_hair.add_vertex((window.width-1-123, 187))
    brown_hair.add_vertex((window.width-1-146, 212))
    brown_hair.add_vertex((window.width-1-183, 166))
    brown_hair.add_vertex((window.width-1-169, 135))  # 10
    brown_hair.add_vertex((window.width-1-191, 92))
    brown_hair.add_vertex((window.width-1-189, 41))
    brown_hair.add_vertex((window.width-1-162, 0))
    brown_hair.add_vertex((window.width-1-256, 0))
    brown_hair.add_vertex((window.width-1-256, 238))  # 15
    brown_hair.add_vertex((window.width-1-82, 238))
    brown_hair.add_vertex((window.width-1-40, 197))
    brown_hair.add_vertex((window.width-1-0, 197))  # 18
    brown_hair.filled = True
    brown_hair.fill_color = "darkorange"
    brown_hair.color = "darkorange"
    window.add(brown_hair)
    # black stripe
    # 1
    black_stripe_1 = GPolygon()
    black_stripe_1.add_vertex((window.width-1-0, 0))  # 1
    black_stripe_1.add_vertex((window.width-1-70, 0))
    black_stripe_1.add_vertex((window.width-1-59, 39))
    black_stripe_1.add_vertex((window.width-1-70, 52))
    black_stripe_1.add_vertex((window.width-1-59, 58))  # 5
    black_stripe_1.add_vertex((window.width-1-59, 80))  # 6
    black_stripe_1.add_vertex((window.width-1-63, 100))
    black_stripe_1.add_vertex((window.width-1-51, 110))
    black_stripe_1.add_vertex((window.width-1-28, 150))
    black_stripe_1.add_vertex((window.width-1-31, 103))  # 10
    black_stripe_1.add_vertex((window.width-1-41, 77))  # 11
    black_stripe_1.add_vertex((window.width-1-42, 52))
    black_stripe_1.add_vertex((window.width-1-20, 66))
    black_stripe_1.add_vertex((window.width-1-19, 107))
    black_stripe_1.add_vertex((window.width-1-0, 150))  # 15
    black_stripe_1.add_vertex((window.width-1-0, 57))
    black_stripe_1.add_vertex((window.width-1-32, 23))
    black_stripe_1.filled = True
    black_stripe_1.color = "black"
    window.add(black_stripe_1)
    # 2
    black_stripe_2 = GPolygon()
    black_stripe_2.add_vertex((window.width-1-30, 152))  # 1
    black_stripe_2.add_vertex((window.width-1-58, 208))
    black_stripe_2.add_vertex((window.width-1-83, 216))
    black_stripe_2.add_vertex((window.width-1-115, 208))
    black_stripe_2.add_vertex((window.width-1-79, 235))  # 5
    black_stripe_2.add_vertex((window.width-1-47, 226))  # 6
    black_stripe_2.filled = True
    black_stripe_2.color = "black"
    window.add(black_stripe_2)
    # 3
    black_stripe_3 = GPolygon()
    black_stripe_3.add_vertex((window.width-1-57, 165))  # 1
    black_stripe_3.add_vertex((window.width-1-73, 190))
    black_stripe_3.add_vertex((window.width-1-121, 188))
    black_stripe_3.add_vertex((window.width-1-85, 166))
    black_stripe_3.add_vertex((window.width-1-89, 178))  # 5
    black_stripe_3.filled = True
    black_stripe_3.color = "black"
    window.add(black_stripe_3)
    # 4
    black_stripe_4 = GPolygon()
    black_stripe_4.add_vertex((window.width-1-85, 167))  # 1
    black_stripe_4.add_vertex((window.width-1-60, 120))
    black_stripe_4.add_vertex((window.width-1-58, 146))
    black_stripe_4.filled = True
    black_stripe_4.color = "black"
    window.add(black_stripe_4)
    # 5
    black_stripe_5 = GPolygon()
    black_stripe_5.add_vertex((window.width-1-62, 100))  # 1
    black_stripe_5.add_vertex((window.width-1-102, 101))
    black_stripe_5.add_vertex((window.width-1-133, 112))
    black_stripe_5.add_vertex((window.width-1-153, 131))
    black_stripe_5.add_vertex((window.width-1-162, 148))  # 5
    black_stripe_5.add_vertex((window.width-1-170, 190))  # 6
    black_stripe_5.add_vertex((window.width-1-149, 212))
    black_stripe_5.add_vertex((window.width-1-141, 178))
    black_stripe_5.add_vertex((window.width-1-121, 176))
    black_stripe_5.add_vertex((window.width-1-101, 164))  # 10
    black_stripe_5.add_vertex((window.width-1-88, 146))  # 11
    black_stripe_5.add_vertex((window.width-1-82, 118))
    black_stripe_5.add_vertex((window.width-1-61, 123))
    black_stripe_5.filled = True
    black_stripe_5.color = "black"
    window.add(black_stripe_5)
    # 6
    black_stripe_6 = GPolygon()
    black_stripe_6.add_vertex((window.width-1-192, 0))  # 1
    black_stripe_6.add_vertex((window.width-1-211, 5))
    black_stripe_6.add_vertex((window.width-1-180, 29))
    black_stripe_6.add_vertex((window.width-1-162, 33))
    black_stripe_6.add_vertex((window.width-1-160, 55))  # 5
    black_stripe_6.add_vertex((window.width-1-145, 61))  # 6
    black_stripe_6.add_vertex((window.width-1-133, 44))
    black_stripe_6.add_vertex((window.width-1-124, 62))
    black_stripe_6.add_vertex((window.width-1-154, 120))
    black_stripe_6.add_vertex((window.width-1-119, 100))  # 10
    black_stripe_6.add_vertex((window.width-1-99, 80))  # 11
    black_stripe_6.add_vertex((window.width-1-71, 67))
    black_stripe_6.add_vertex((window.width-1-92, 65))
    black_stripe_6.add_vertex((window.width-1-99, 47))
    black_stripe_6.add_vertex((window.width-1-104, 50))  # 15
    black_stripe_6.add_vertex((window.width-1-99, 65))  # 16
    black_stripe_6.add_vertex((window.width-1-127, 91))
    black_stripe_6.add_vertex((window.width-1-110, 62))
    black_stripe_6.add_vertex((window.width-1-121, 45))
    black_stripe_6.add_vertex((window.width-1-120, 31))  # 20
    black_stripe_6.add_vertex((window.width-1-130, 18))
    black_stripe_6.add_vertex((window.width-1-162, 19))  # 22
    black_stripe_6.filled = True
    black_stripe_6.color = "black"
    window.add(black_stripe_6)
    # 7
    black_stripe_7 = GPolygon()
    black_stripe_7.add_vertex((window.width-1-256, 0))  # 1
    black_stripe_7.add_vertex((window.width-1-231, 20))
    black_stripe_7.add_vertex((window.width-1-223, 8))
    black_stripe_7.add_vertex((window.width-1-192, 38))
    black_stripe_7.add_vertex((window.width-1-181, 65))  # 5
    black_stripe_7.add_vertex((window.width-1-190, 96))  # 6
    black_stripe_7.add_vertex((window.width-1-180, 126))
    black_stripe_7.add_vertex((window.width-1-191, 124))
    black_stripe_7.add_vertex((window.width-1-195, 102))
    black_stripe_7.add_vertex((window.width-1-211, 89))  # 10
    black_stripe_7.add_vertex((window.width-1-203, 81))  # 11
    black_stripe_7.add_vertex((window.width-1-199, 52))
    black_stripe_7.add_vertex((window.width-1-200, 43))
    black_stripe_7.add_vertex((window.width-1-222, 31))
    black_stripe_7.add_vertex((window.width-1-231, 56))  # 15
    black_stripe_7.add_vertex((window.width-1-225, 76))  # 16
    black_stripe_7.add_vertex((window.width-1-215, 89))
    black_stripe_7.add_vertex((window.width-1-226, 94))
    black_stripe_7.add_vertex((window.width-1-241, 68))
    black_stripe_7.add_vertex((window.width-1-250, 47))  # 20
    black_stripe_7.add_vertex((window.width-1-252, 81))
    black_stripe_7.add_vertex((window.width-1-234, 112))
    black_stripe_7.add_vertex((window.width-1-256, 123))  # 23
    black_stripe_7.filled = True
    black_stripe_7.color = "black"
    window.add(black_stripe_7)
    # 8
    black_stripe_8 = GPolygon()
    black_stripe_8.add_vertex((window.width-1-193, 126))  # 1
    black_stripe_8.add_vertex((window.width-1-189, 144))
    black_stripe_8.add_vertex((window.width-1-216, 121))
    black_stripe_8.add_vertex((window.width-1-225, 99))
    black_stripe_8.add_vertex((window.width-1-208, 117))  # 5
    black_stripe_8.filled = True
    black_stripe_8.color = "black"
    window.add(black_stripe_8)
    # lower-eyelid
    lower_eyelid = GPolygon()
    lower_eyelid.add_vertex((window.width-1-78, 107))  # 1
    lower_eyelid.add_vertex((window.width-1-84, 110))
    lower_eyelid.add_vertex((window.width-1-96, 150))
    lower_eyelid.add_vertex((window.width-1-114, 162))
    lower_eyelid.add_vertex((window.width-1-138, 164))  # 5
    lower_eyelid.add_vertex((window.width-1-154, 168))
    lower_eyelid.add_vertex((window.width-1-160, 150))
    lower_eyelid.add_vertex((window.width-1-159, 187))
    lower_eyelid.add_vertex((window.width-1-137, 167))
    lower_eyelid.add_vertex((window.width-1-114, 165))  # 10
    lower_eyelid.add_vertex((window.width-1-94, 153))
    lower_eyelid.add_vertex((window.width-1-82, 111))
    lower_eyelid.filled = True
    lower_eyelid.color = "thistle"
    lower_eyelid.fill_color = "thistle"
    window.add(lower_eyelid)
    # eye
    # eye-gold_eye
    gold_eye = GOval(52, 50, x=270+94, y=103)
    gold_eye.filled = True
    gold_eye.color = "gold"
    gold_eye.fill_color = "gold"
    window.add(gold_eye)
    # eye-pupil
    pupil = GOval(13, 12, x=270+113, y=122)
    pupil.filled = True
    pupil.fill_color = "black"
    window.add(pupil)
    # eye-small_light
    small_light = GOval(4, 4, x=255+124, y=124)
    small_light.filled = True
    small_light.color = "white"
    small_light.fill_color = "white"
    window.add(small_light)
    # eye-big_light
    big_light = GOval(10, 11, x=290+104, y=118)
    big_light.filled = True
    big_light.color = "white"
    big_light.fill_color = "white"
    window.add(big_light)
    # eyelid
    # eyelid_white
    eyelid_white = GPolygon()
    eyelid_white.add_vertex((window.width-1-105, 97))
    eyelid_white.add_vertex((window.width-1-133, 101))
    eyelid_white.add_vertex((window.width-1-155, 117))
    eyelid_white.add_vertex((window.width-1-154, 142))
    eyelid_white.add_vertex((window.width-1-126, 115))
    eyelid_white.add_vertex((window.width-1-93, 107))
    eyelid_white.filled = True
    eyelid_white.fill_color = "burlywood"
    eyelid_white.color = "burlywood"
    window.add(eyelid_white)
    # eyelid_black
    eyelid_black = GPolygon()
    eyelid_black.add_vertex((window.width-1-91, 100))
    eyelid_black.add_vertex((window.width-1-129, 108))
    eyelid_black.add_vertex((window.width-1-157, 132))
    eyelid_black.add_vertex((window.width-1-156, 147))
    eyelid_black.add_vertex((window.width-1-126, 120))
    eyelid_black.add_vertex((window.width-1-91, 111))
    eyelid_black.add_vertex((window.width-1-87, 104))
    eyelid_black.filled = True
    eyelid_black.fill_color = "black"
    window.add(eyelid_black)
    # nose
    nose = GPolygon()
    nose.add_vertex((window.width-1-256, 170))
    nose.add_vertex((window.width-1-256, 238))
    nose.add_vertex((window.width-1-163, 238))
    nose.filled = True
    nose.fill_color = "chocolate"
    nose.color = "chocolate"
    window.add(nose)
    # 3.create the label
    # label
    label = GLabel("Life", x=210, y=50)
    label.font = "Courier-30-bold"
    label.color = "white"
    window.add(label)
    label = GLabel("of", x=235, y=95)
    label.font = "Courier-25-bold"
    label.color = "white"
    window.add(label)
    label = GLabel("π", x=228, y=180)
    label.font = "Courier-70-bold"
    label.color = "white"
    window.add(label)
Ejemplo n.º 12
0
def main():
    """
    it shows the animation of a guinea pig with zentangle pattern, and a label will show on the top of window
    """
    #background

    background = GRect(600, 600)
    background.filled = True
    window.add(background)


    #zentangle

    for i in range(0,600,30):
        line = GLine(i,0,600,600)
        window.add(line)
        line.color = 'white'
        pause(10)

    for j in range(0,600,30):
        line = GLine(600,j,0,600)
        window.add(line)
        line.color = 'wheat'
        pause(10)

    for k in range(0, 600, 30):
        line = GLine(600-k, 600, 0, 0)
        window.add(line)
        line.color = 'whitesmoke'
        pause(10)

    for l in range(0, 600, 30):
        line = GLine(0, 600-l, 600, 0)
        window.add(line)
        line.color = 'grey'
        pause(10)



    for m in range(0,300, 10):
        circle = GOval(m, m, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'red'
        pause(10)

    for n in range(0, 200, 40):
        circle = GOval(n, n, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'orange'
        pause(10)

    for o in range(100,300, 35):
        circle = GOval(o, o, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'yellow'
        pause(10)

    for p in range(50,200, 25):
        circle = GOval(p, p, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'lime'
        pause(10)

    for q in range(0,100, 15):
        circle = GOval(q, q, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'lightblue'
        pause(10)

    for r in range(300, 500, 30):
        circle = GOval(r, r, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'navy'
        pause(10)

    for s in range(0, 400, 50):
        circle = GOval(s, s, x=random.randrange(0, window.width), y=random.randrange(0, window.width))
        window.add(circle)
        circle.color = 'purple'
        pause(10)


    #face
    face = GPolygon()
    face.add_vertex((255, 250))
    face.add_vertex((345, 250))
    face.add_vertex((355, 340))
    face.add_vertex((245, 340))

    forehead = GPolygon()
    forehead.add_vertex((270, 255))
    forehead.add_vertex((330, 255))
    forehead.add_vertex((335, 275))
    forehead.add_vertex((265, 275))

    l_chin = GPolygon()
    l_chin = GPolygon()
    l_chin.add_vertex((250, 310))
    l_chin.add_vertex((300, 305))
    l_chin.add_vertex((300, 340))
    l_chin.add_vertex((247, 340))

    r_chin = GPolygon()
    r_chin = GPolygon()
    r_chin.add_vertex((300, 305))
    r_chin.add_vertex((350, 310))
    r_chin.add_vertex((353, 340))
    r_chin.add_vertex((300, 340))

    nose = GOval(18, 35, x=292, y=290)

    l_eye = GOval(15, 17, x=280, y=285)
    r_eye = GOval(15, 17, x=310, y=285)

    l_foot = GOval(20, 30, x=233, y=315)
    r_foot = GOval(20, 30, x=348, y=315)

    l_ear = GOval(25, 15, x=230, y=265)
    r_ear = GOval(25, 15, x=345, y=265)

    mouse1 = GLine(300, 340, 300, 333)
    mouse2 = GLine(300, 333, 293, 323)
    mouse3 = GLine(300, 333, 307, 323)

    window.add(l_foot)
    l_foot.filled = True
    l_foot.fill_color = 'lightsalmon'
    l_foot.color = 'lightsalmon'

    window.add(r_foot)
    r_foot.filled = True
    r_foot.fill_color = 'lightsalmon'
    r_foot.color = 'lightsalmon'

    window.add(face)
    face.filled = True
    face.fill_color = 'goldenrod'
    face.color = 'goldenrod'

    window.add(forehead)
    forehead.filled = True
    forehead.fill_color = 'lightyellow'
    forehead.color = 'peachpuff'

    window.add(l_chin)
    l_chin.filled = True
    l_chin.fill_color = 'wheat'
    l_chin.color = 'wheat'

    window.add(r_chin)
    r_chin.filled = True
    r_chin.fill_color = 'wheat'
    r_chin.color = 'wheat'

    window.add(nose)
    nose.filled = True
    nose.fill_color = 'wheat'
    nose.color = 'wheat'

    window.add(mouse1)
    mouse1.color = 'brown'
    window.add(mouse2)
    mouse2.color = 'brown'
    window.add(mouse3)
    mouse3.color = 'brown'

    window.add(l_eye)
    l_eye.filled = True
    window.add(r_eye)
    r_eye.filled = True

    window.add(l_ear)
    l_ear.filled = True
    l_ear.fill_color = 'brown'
    l_ear.color = 'brown'
    window.add(r_ear)
    r_ear.filled = True
    r_ear.fill_color = 'brown'
    r_ear.color = 'brown'


    # words
    label = GLabel('Python is just like Zentangle - impossible to have the same works')
    label.font = 'Courier-10-italic'
    words_frame = GRect(530, 40, x=(window.width - label.width - 10) / 2, y=18)
    label.color = 'navy'

    window.add(words_frame)
    words_frame.filled = True
    words_frame.fill_color = 'lemonchiffon'
    words_frame.color = 'gold'
    window.add(label, x=(window.width - label.width) / 2, y=50)

    vx = 1
    while True:
        label.move(vx, 0)
        words_frame.move(vx, 0)
        if words_frame.x <= 0 or words_frame.x + words_frame.width >= window.width:
            vx = -vx
        pause(DELAY)
Ejemplo n.º 13
0
def main():
    """
    TODO:
    """
    window = GWindow(width=550, height=550, title='Pikachu')
    ball = GOval(550, 550)
    ball.filled = True
    ball.fill_color = 'red'
    window.add(ball, 0, 0)
    ball2 = GRect(550, 275)
    ball2.filled = True
    ball2.fill_color = 'white'
    window.add(ball2, 0, 275)
    ball3 = GOval(550, 550)
    window.add(ball3)
    ball4 = GRect(550, 50)
    ball4.filled = True
    ball4.fill_color = 'black'
    window.add(ball4, 0, 250)
    tail = GRect(40, 20)
    tail.filled = True
    tail.fill_color = 'gold'
    tail.color = 'gold'
    window.add(tail, 350, 325)
    tail2 = GRect(20, 60)
    tail2.filled = True
    tail2.fill_color = 'gold'
    tail2.color = 'gold'
    window.add(tail2, 370, 280)
    tail = GRect(40, 20)
    tail.filled = True
    tail.fill_color = 'gold'
    tail.color = 'gold'
    window.add(tail, 370, 280)
    tail = GRect(30, 50)
    tail.filled = True
    tail.fill_color = 'gold'
    tail.color = 'gold'
    window.add(tail, 390, 260)
    tail = GRect(100, 50)
    tail.filled = True
    tail.fill_color = 'gold'
    tail.color = 'gold'
    window.add(tail, 390, 230)
    body = GRect(130, 180)
    body.filled = True
    body.fill_color = 'gold'
    window.add(body, 212, 200)
    body2 = GRect(100, 100)
    body2.filled = True
    body2.fill_color = 'gold'
    body2.color = 'gold'
    window.add(body2, 220, 287)
    body3 = GPolygon()
    body3.add_vertex((214, 220))
    body3.add_vertex((193, 330))
    body3.add_vertex((220, 330))
    body3.filled = True
    body3.fill_color = 'gold'
    body3.color = 'gold'
    window.add(body3)
    body3 = GPolygon()
    body3.add_vertex((340, 220))
    body3.add_vertex((343, 330))
    body3.add_vertex((358, 330))
    body3.filled = True
    body3.fill_color = 'gold'
    body3.color = 'gold'
    window.add(body3)
    l_leg = GOval(100, 90)
    l_leg.filled = True
    l_leg.fill_color = 'gold'
    l_leg.color = 'gold'
    window.add(l_leg, 190, 300)
    r_leg = GOval(100, 90)
    r_leg.filled = True
    r_leg.fill_color = 'gold'
    r_leg.color = 'gold'
    window.add(r_leg, 260, 300)
    body2 = GRect(100, 100)
    body2.filled = True
    body2.fill_color = 'gold'
    body2.color = 'gold'
    window.add(body2, 220, 287)
    body3 = GPolygon()
    body3.add_vertex((214, 220))
    body3.add_vertex((193, 330))
    body3.add_vertex((220, 330))
    body3.filled = True
    body3.fill_color = 'gold'
    body3.color = 'gold'
    window.add(body3)
    body4 = GPolygon()
    body4.add_vertex((340, 220))
    body4.add_vertex((343, 330))
    body4.add_vertex((358, 330))
    body4.filled = True
    body4.fill_color = 'gold'
    body4.color = 'gold'
    window.add(body4)
    l_leg = GOval(100, 90)
    l_leg.filled = True
    l_leg.fill_color = 'gold'
    l_leg.color = 'gold'
    window.add(l_leg, 190, 300)
    l_hand = GOval(40, 125)
    l_hand.filled = True
    l_hand.fill_color = 'gold'
    window.add(l_hand, 200, 225)
    l_leg2 = GOval(20, 60)
    l_leg2.filled = True
    l_leg2.fill_color = 'gold'
    window.add(l_leg2, 210, 340)
    l_leg3 = GLine(217, 340, 217, 360)
    window.add(l_leg3)
    l_leg4 = GLine(222, 340, 222, 360)
    window.add(l_leg4)
    r_leg = GOval(100, 90)
    r_leg.filled = True
    r_leg.fill_color = 'gold'
    r_leg.color = 'gold'
    window.add(r_leg, 260, 300)
    r_hand = GOval(40, 125)
    r_hand.filled = True
    r_hand.fill_color = 'gold'
    window.add(r_hand, 310, 225)
    r_leg2 = GOval(20, 60)
    r_leg2.filled = True
    r_leg2.fill_color = 'gold'
    window.add(r_leg2, 320, 340)
    r_leg3 = GLine(327, 340, 327, 360)
    window.add(r_leg3)
    r_leg4 = GLine(332, 340, 332, 360)
    window.add(r_leg4)
    l_ear = GOval(100, 30)
    l_ear.filled = True
    l_ear.fill_color = 'gold'
    window.add(l_ear, 135, 110)
    l_ear2 = GPolygon()
    l_ear2.add_vertex((120, 125))
    l_ear2.add_vertex((145, 115))
    l_ear2.add_vertex((145, 135))
    l_ear2.filled = True
    l_ear2.fill_color = 'black'
    window.add(l_ear2)
    r_ear = GOval(30, 100)
    r_ear.filled = True
    r_ear.fill_color = 'gold'
    window.add(r_ear, 300, 25)
    r_ear2 = GPolygon()
    r_ear2.add_vertex((315, 10))
    r_ear2.add_vertex((305, 35))
    r_ear2.add_vertex((325, 35))
    r_ear2.filled = True
    r_ear2.fill_color = 'black'
    window.add(r_ear2)
    face4 = GOval(152, 156)
    face4.filled = True
    face4.fill_color = 'gold'
    window.add(face4, 199, 100)
    face2 = GOval(90, 100)
    face2.filled = True
    face2.fill_color = 'gold'
    window.add(face2, 195, 140)
    face3 = GOval(90, 100)
    face3.filled = True
    face3.fill_color = 'gold'
    window.add(face3, 265, 140)
    face = GOval(150, 155)
    face.filled = True
    face.fill_color = 'gold'
    face.color = 'gold'
    window.add(face, 200, 100)
    l_eye = GOval(30, 30)
    l_eye.filled = True
    l_eye.fill_color = 'black'
    window.add(l_eye, 225, 150)
    l_eye2 = GOval(15, 15)
    l_eye2.filled = True
    l_eye2.fill_color = 'white'
    window.add(l_eye2, 235, 150)
    r_eye = GOval(30, 30)
    r_eye.filled = True
    r_eye.fill_color = 'black'
    window.add(r_eye, 295, 150)
    r_eye2 = GOval(15, 15)
    r_eye2.filled = True
    r_eye2.fill_color = 'white'
    window.add(r_eye2, 298, 153)
    nose = GOval(5, 5)
    nose.filled = True
    nose.fill_color = 'black'
    window.add(nose, 270, 190)
    l_face = GOval(33, 33)
    l_face.filled = True
    l_face.fill_color = 'tomato'
    window.add(l_face, 200, 190)
    l_face = GOval(33, 33)
    l_face.filled = True
    l_face.fill_color = 'tomato'
    window.add(l_face, 320, 190)
    mouth = GPolygon()
    mouth.add_vertex((260, 205))
    mouth.add_vertex((285, 205))
    mouth.add_vertex((272, 240))
    mouth.filled = True
    mouth.fill_color = 'darkred'
    window.add(mouth)
Ejemplo n.º 14
0
def main():
    """
    A stock trading apps screen.
    Dream come True!
    Hope I won't see this terrible scene on my phone in my lifetime ....
    """
    top_line = GRect(450, 20, x=0, y=0)
    top_line.filled = True
    top_line.color = 'darkblue'
    top_line.fill_color = 'darkblue'
    window.add(top_line)

    time_label = GLabel(' 下午 1:30 ')
    time_label.font = 'Courier-14'
    time_label.color = 'white'
    window.add(time_label, 10, 22)

    power_label = GLabel(' 10% ')
    power_label.font = 'Helvetica-14'
    power_label.color = 'white'
    window.add(power_label, 400, 22)

    power = GRect(10, 15, x=390, y=3)
    power.filled = True
    power.color = 'red'
    power.fill_color = 'red'
    window.add(power)

    tool_bar = GRect(450, 35, x=0, y=21)
    tool_bar.filled = True
    tool_bar.color = 'black'
    tool_bar.fill_color = 'black'
    window.add(tool_bar)

    tool_bar_label = GLabel(' 下單  委託  明細  庫存  帳務 ')
    tool_bar_label.font = 'Courier-18'
    tool_bar_label.color = 'white'
    window.add(tool_bar_label, 30, 55)

    find_mark = GOval(25, 25, x=410, y=25)
    find_mark.filled = False
    find_mark.color = 'white'
    window.add(find_mark)

    find_mark_2 = GLine(435, 45, 445, 55)
    find_mark_2.filled = False
    find_mark_2.color = 'white'
    window.add(find_mark_2)

    tool_bar_tri = GPolygon()
    tool_bar_tri.add_vertex((15, 40))
    tool_bar_tri.add_vertex((30, 50))
    tool_bar_tri.add_vertex((30, 30))
    tool_bar_tri.filled = True
    tool_bar_tri.fill_color = 'white'
    window.add(tool_bar_tri)

    mid_up = GRect(450, 200, x=0, y=56)
    mid_up.filled = True
    mid_up.color = 'black'
    mid_up.fill_color = 'black'
    window.add(mid_up)

    account = GRect(250, 35, x=10, y=56)
    account.filled = False
    account.color = 'white'
    window.add(account)

    account_label = GLabel(' 證878787-66666')
    account_label.font = 'Courier-18'
    account_label.color = 'white'
    window.add(account_label, 10, 90)

    account_tri = GPolygon()
    account_tri.add_vertex((240, 85))
    account_tri.add_vertex((250, 65))
    account_tri.add_vertex((230, 65))
    account_tri.filled = True
    account_tri.fill_color = 'white'
    window.add(account_tri)

    account_r = GRect(150, 35, x=280, y=56)
    account_r.filled = False
    account_r.color = 'white'
    window.add(account_r)

    account_label_r = GLabel(' 現股 ')
    account_label_r.font = 'Courier-18'
    account_label_r.color = 'white'
    window.add(account_label_r, 330, 90)

    account_tri_r = GPolygon()
    account_tri_r.add_vertex((410, 85))
    account_tri_r.add_vertex((420, 65))
    account_tri_r.add_vertex((400, 65))
    account_tri_r.filled = True
    account_tri_r.fill_color = 'white'
    window.add(account_tri_r)

    payback_mark = GOval(120, 120, x=50, y=105)
    payback_mark.filled = True
    payback_mark.fill_color = 'limegreen'
    payback_mark.color = 'limegreen'
    window.add(payback_mark)

    payback_mark2 = GOval(100, 100, x=60, y=115)
    payback_mark2.filled = True
    payback_mark2.fill_color = 'black'
    window.add(payback_mark2)

    payback_label = GLabel('股票報酬')
    payback_label.font = 'Courier-13'
    payback_label.color = 'white'
    window.add(payback_label, 75, 160)

    payback_label2 = GLabel('-100%')
    payback_label2.font = 'Courier-15'
    payback_label2.color = 'limegreen'
    window.add(payback_label2, 80, 190)

    payback_worth = GLabel('股票市值         0')
    payback_worth.font = 'Courier-16'
    payback_worth.color = 'white'
    window.add(payback_worth, 200, 130)

    payback_cost = GLabel('總成本     2,000,000')
    payback_cost.font = 'Courier-16'
    payback_cost.color = 'white'
    window.add(payback_cost, 200, 170)

    coin_style = GLabel('(幣別:新台幣)')
    coin_style.font = 'Courier-12'
    coin_style.color = 'white'
    window.add(coin_style, 330, 200)

    counting = GRect(110, 35, x=200, y=210)
    counting.filled = True
    counting.fill_color = 'darkblue'
    counting.color = 'white'
    window.add(counting)

    searching = GRect(110, 35, x=320, y=210)
    searching.filled = True
    searching.fill_color = 'darkblue'
    searching.color = 'white'
    window.add(searching)

    counting_label = GLabel('當沖試算')
    counting_label.font = 'Courier-16'
    counting_label.color = 'white'
    window.add(counting_label, 213, 240)

    searching_label = GLabel('維持率試算')
    searching_label.font = 'Courier-15'
    searching_label.color = 'white'
    window.add(searching_label, 323, 240)

    real_payback = GLabel('報酬 -2,000,000')
    real_payback.font = 'Courier-12'
    real_payback.color = 'limegreen'
    window.add(real_payback, 40, 250)

    mid_blue_bar = GRect(450, 50, x=0, y=256)
    mid_blue_bar.filled = True
    mid_blue_bar.fill_color = 'midnightblue'
    mid_blue_bar.color = 'blue'
    window.add(mid_blue_bar)

    mid_blue_label = GLabel(' 名稱    市/均     股數/可下單數     損益')
    mid_blue_label.font = 'cCourier-20'
    mid_blue_label.color = 'white'
    window.add(mid_blue_label, 0, 295)

    first = GRect(450, 80, x=0, y=306)
    first.filled = True
    first.fill_color = 'black'
    first.color = 'blue'
    window.add(first)

    first_label_1 = GLabel(' 台G電     0.0000              400 ')
    first_label_1.font = 'cCourier-18'
    first_label_1.color = 'white'
    window.add(first_label_1, 0, 345)

    first_label_r1 = GLabel('-400,000')
    first_label_r1.font = 'cCourier-18'
    first_label_r1.color = 'limegreen'
    window.add(first_label_r1, 360, 345)

    first_label_2 = GLabel('   現股      1000.0              400 ')
    first_label_2.font = 'cCourier-18'
    first_label_2.color = 'white'
    window.add(first_label_2, 0, 375)

    first_label_r2 = GLabel('-100.00%')
    first_label_r2.font = 'cCourier-18'
    first_label_r2.color = 'limegreen'
    window.add(first_label_r2, 360, 375)

    second = GRect(450, 80, x=0, y=386)
    second.filled = True
    second.fill_color = 'black'
    second.color = 'blue'
    window.add(second)

    second_label_1 = GLabel(' 大綠光    0.0000              400 ')
    second_label_1.font = 'cCourier-18'
    second_label_1.color = 'white'
    window.add(second_label_1, 0, 425)

    second_label_r1 = GLabel('-400,000')
    second_label_r1.font = 'cCourier-18'
    second_label_r1.color = 'limegreen'
    window.add(second_label_r1, 360, 425)

    second_label_2 = GLabel('   現股      1000.0              400 ')
    second_label_2.font = 'cCourier-18'
    second_label_2.color = 'white'
    window.add(second_label_2, 0, 455)

    second_label_r2 = GLabel('-100.00%')
    second_label_r2.font = 'cCourier-18'
    second_label_r2.color = 'limegreen'
    window.add(second_label_r2, 360, 455)

    third = GRect(450, 80, x=0, y=466)
    third.filled = True
    third.fill_color = 'black'
    third.color = 'blue'
    window.add(third)

    third_label_1 = GLabel(' 連發哥    0.0000              400 ')
    third_label_1.font = 'cCourier-18'
    third_label_1.color = 'white'
    window.add(third_label_1, 0, 505)

    third_label_r1 = GLabel('-400,000')
    third_label_r1.font = 'cCourier-18'
    third_label_r1.color = 'limegreen'
    window.add(third_label_r1, 360, 505)

    third_label_2 = GLabel('   現股      1000.0              400 ')
    third_label_2.font = 'cCourier-18'
    third_label_2.color = 'white'
    window.add(third_label_2, 0, 535)

    third_label_r2 = GLabel('-100.00%')
    third_label_r2.font = 'cCourier-18'
    third_label_r2.color = 'limegreen'
    window.add(third_label_r2, 360, 535)

    four = GRect(450, 80, x=0, y=546)
    four.filled = True
    four.fill_color = 'black'
    four.color = 'blue'
    window.add(four)

    four_label_1 = GLabel(' 海公公    0.0000              400 ')
    four_label_1.font = 'cCourier-18'
    four_label_1.color = 'white'
    window.add(four_label_1, 0, 585)

    four_label_r1 = GLabel('-400,000')
    four_label_r1.font = 'cCourier-18'
    four_label_r1.color = 'limegreen'
    window.add(four_label_r1, 360, 585)

    four_label_2 = GLabel('   現股      1000.0              400 ')
    four_label_2.font = 'cCourier-18'
    four_label_2.color = 'white'
    window.add(four_label_2, 0, 615)

    four_label_r2 = GLabel('-100.00%')
    four_label_r2.font = 'cCourier-18'
    four_label_r2.color = 'limegreen'
    window.add(four_label_r2, 360, 615)

    fifth = GRect(450, 80, x=0, y=626)
    fifth.filled = True
    fifth.fill_color = 'black'
    fifth.color = 'blue'
    window.add(fifth)

    fifth_label_1 = GLabel(' 種花電    0.0000              400 ')
    fifth_label_1.font = 'cCourier-18'
    fifth_label_1.color = 'white'
    window.add(fifth_label_1, 0, 665)

    fifth_label_r1 = GLabel('-400,000')
    fifth_label_r1.font = 'cCourier-18'
    fifth_label_r1.color = 'limegreen'
    window.add(fifth_label_r1, 360, 665)

    fifth_label_2 = GLabel('   現股      1000.0              400 ')
    fifth_label_2.font = 'cCourier-18'
    fifth_label_2.color = 'white'
    window.add(fifth_label_2, 0, 695)

    fifth_label_r2 = GLabel('-100.00%')
    fifth_label_r2.font = 'cCourier-18'
    fifth_label_r2.color = 'limegreen'
    window.add(fifth_label_r2, 360, 695)

    final = GRect(450, 200, x=0, y=707)
    final.filled = True
    final.fill_color = 'black'
    final.color = 'black'
    window.add(final)

    bot = GRect(450, 50, x=0, y=857)
    bot.filled = True
    bot.fill_color = 'darkgrey'
    bot.color = 'gray'
    window.add(bot)

    bot_tri = GPolygon()
    bot_tri.add_vertex((100, 890))
    bot_tri.add_vertex((80, 880))
    bot_tri.add_vertex((100, 870))
    bot_tri.filled = False
    bot_tri.color = 'white'
    bot_tri.fill_color = 'white'
    window.add(bot_tri)

    bot_oval = GOval(25, 25, x=207, y=868)
    bot_oval.filled = False
    bot_oval.color = 'white'
    bot_oval.fill_color = 'white'
    window.add(bot_oval)

    bot_rect = GRect(20, 20, x=347, y=870)
    bot_rect.filled = False
    bot_rect.color = 'white'
    bot_rect.fill_color = 'white'
    window.add(bot_rect)

    house_tri = GPolygon()
    house_tri.add_vertex((20, 835))
    house_tri.add_vertex((50, 835))
    house_tri.add_vertex((35, 820))
    house_tri.filled = True
    house_tri.fill_color = 'white'
    window.add(house_tri)

    house_rect1 = GRect(8, 13, x=25, y=835)
    house_rect1.filled = True
    house_rect1.fill_color = 'white'
    window.add(house_rect1)

    house_rect2 = GRect(8, 13, x=36, y=835)
    house_rect2.filled = True
    house_rect2.fill_color = 'white'
    window.add(house_rect2)

    house_label = GLabel('  選股    自選     交易    行情     專家')
    house_label.font = 'cCourier-18'
    house_label.color = 'white'
    window.add(house_label, 80, 850)

    warn = GLabel('*注意事項*')
    warn.font = 'cCourier-15'
    warn.color = 'white'
    window.add(warn, 10, 810)

    warn_line = GLabel('*投資一定有風險,基金投資幾乎穩賠,申購前應詳閱公開說明書。*')
    warn_line.font = 'cCourier-8'
    warn_line.color = 'white'
    window.add(warn_line, 120, 805)
Ejemplo n.º 15
0
def build_labels():
    """
    This function creates the texts on the canvas
    """
    l_title = GLabel('Which one is Karel?')
    l_title.font = 'Courier-25'
    l_title.color = 'black'
    window.add(l_title, x=260, y=60)
    l_num = GLabel('19')
    l_num.font = 'Courier-50'
    l_num.color = 'whitesmoke'
    window.add(l_num, x=37, y=242)
    l_skip = GLabel('skip')
    l_skip.font = 'Courier-20'
    l_skip.color = 'whitesmoke'
    window.add(l_skip, x=726, y=152)
    l_ans1 = GLabel('Answers')
    l_ans1.font = 'Courier-20-italic'
    l_ans1.color = 'black'
    window.add(l_ans1, x=698, y=270)
    l_ans2 = GLabel('0')
    l_ans2.font = 'Courier-50-italic'
    l_ans2.color = 'black'
    window.add(l_ans2, x=722, y=252)
    l_game_pin = GLabel('Game PIN: SC101')
    l_game_pin.font = 'Courier-20'
    l_game_pin.color = 'black'
    window.add(l_game_pin, x=20, y=540)
    l_1 = GPolygon()
    l_1.add_vertex((210, 360))
    l_1.add_vertex((197, 380))
    l_1.add_vertex((221, 380))
    l_1.filled = True
    l_1.color = 'whitesmoke'
    l_1.fill_color= 'whitesmoke'
    window.add(l_1)
    l_2_1 = GPolygon()
    l_2_1.add_vertex((210+380, 359))
    l_2_1.add_vertex((198+380, 370))
    l_2_1.add_vertex((221+380, 370))
    l_2_1.filled = True
    l_2_1.fill_color = 'whitesmoke'
    l_2_1.color = 'whitesmoke'
    window.add(l_2_1)
    l_2_2 = GPolygon()
    l_2_2.add_vertex((210+380, 381))
    l_2_2.add_vertex((198+380, 370))
    l_2_2.add_vertex((221+380, 370))
    l_2_2.filled = True
    l_2_2.fill_color = 'whitesmoke'
    l_2_2.color = 'whitesmoke'
    window.add(l_2_2)
    l_3 = GOval(23, 23, x=198, y=450)
    l_3.filled = True
    l_3.fill_color = 'whitesmoke'
    l_3.color = 'whitesmoke'
    window.add(l_3)
    l_4 = GRect(20, 20, x=583, y=450)
    l_4.filled = True
    l_4.fill_color = 'whitesmoke'
    l_4.color = 'whitesmoke'
    window.add(l_4)
Ejemplo n.º 16
0
def main():
    """
    lovely Patrick Star !!
    """
    window = GWindow(width=400, height=500)
    body = GPolygon()
    body.add_vertex((150, 150))
    body.add_vertex((250, 150))
    body.add_vertex((275, 350))
    body.add_vertex((125, 350))
    body.filled = True
    body.color = 'pink'
    body.fill_color = 'pink'
    window.add(body)

    head = GOval(100, 100, x=150, y=100)
    head.filled = True
    head.fill_color = 'pink'
    head.color = 'pink'
    window.add(head)

    upleg = GRect(150, 75, x=125, y=350)
    upleg.filled = True
    upleg.color = 'seagreen'
    upleg.fill_color = 'seagreen'
    window.add(upleg)

    lleg = GRect(60, 10, x=125, y=425)
    lleg.filled = True
    lleg.color = 'seagreen'
    lleg.fill_color = 'seagreen'
    window.add(lleg)

    rleg = GRect(60, 10, x=215, y=425)
    rleg.filled = True
    rleg.color = 'seagreen'
    rleg.fill_color = 'seagreen'
    window.add(rleg)

    lfeet = GPolygon()
    lfeet.add_vertex((135, 435))
    lfeet.add_vertex((175, 435))
    lfeet.add_vertex((155, 460))
    lfeet.filled = True
    lfeet.color = 'pink'
    lfeet.fill_color = 'pink'
    window.add(lfeet)

    rfeet = GPolygon()
    rfeet.add_vertex((225, 435))
    rfeet.add_vertex((265, 435))
    rfeet.add_vertex((245, 460))
    rfeet.filled = True
    rfeet.color = 'pink'
    rfeet.fill_color = 'pink'
    window.add(rfeet)

    leyebrow1 = GLine(165, 150, 185, 147)
    leyebrow1.fill = 'black'
    window.add(leyebrow1)
    leyebrow2 = GLine(165, 155, 185, 152)
    leyebrow2.fill = 'black'
    window.add(leyebrow2)
    leyebrow3 = GLine(165, 160, 185, 157)
    leyebrow3.fill = 'black'
    window.add(leyebrow3)

    reyebrow1 = GLine(215, 147, 235, 150)
    reyebrow1.fill = 'black'
    window.add(reyebrow1)
    reyebrow2 = GLine(215, 152, 235, 155)
    reyebrow2.fill = 'black'
    window.add(reyebrow2)
    reyebrow3 = GLine(215, 157, 235, 160)
    reyebrow3.fill = 'black'
    window.add(reyebrow3)

    leye = GOval(35, 75, x=165, y=170)
    leye.filled = True
    leye.fill_color = 'white'
    window.add(leye)

    reye = GOval(35, 75, x=200, y=170)
    reye.filled = True
    reye.fill_color = 'white'
    window.add(reye)

    lcore = GOval(10, 10, x=180, y=205)
    lcore.filled = True
    lcore.fill_color = 'black'
    lcore.color = 'black'
    window.add(lcore)

    rcore = GOval(10, 10, x=210, y=205)
    rcore.filled = True
    rcore.fill_color = 'black'
    rcore.color = 'black'
    window.add(rcore)

    smile = GArc(100, 50, 180, 180, x=150, y=265)
    window.add(smile)

    lhand = GPolygon()
    lhand.add_vertex((75, 250))
    lhand.add_vertex((125, 350))
    lhand.add_vertex((200, 350))
    lhand.filled = True
    lhand.color = 'pink'
    lhand.fill_color = 'pink'
    window.add(lhand)

    rhand = GPolygon()
    rhand.add_vertex((325, 250))
    rhand.add_vertex((275, 350))
    rhand.add_vertex((200, 350))
    rhand.filled = True
    rhand.color = 'pink'
    rhand.fill_color = 'pink'
    window.add(rhand)

    line = GLine(75, 250, 75, 100)
    window.add(line)

    ball = GOval(100, 75, x=35, y=50)
    ball.filled = True
    ball.fill_color = 'red'
    window.add(ball)

    label = GLabel('Stancode_SC101', x=40, y=95)
    label.color = 'white'
    window.add(label)
Ejemplo n.º 17
0
def main():
    window = GWindow(width=600, height=500, title='tsum tsum')
    """
    #1 Aliens
    """

    background = GRect(600, 500)
    background.filled = True
    background.fill_color = 'white'
    window.add(background)

    mickey_lear = GOval(150, 150, x=80, y=160)
    mickey_lear.color = 'black'
    mickey_lear.filled = True
    mickey_lear.fill_color = 'limegreen'
    window.add(mickey_lear)

    alien_cover_lear = GOval(150, 150, x=130, y=120)
    alien_cover_lear.color = 'white'
    alien_cover_lear.filled = True
    alien_cover_lear.fill_color = 'white'
    window.add(alien_cover_lear)

    alien_rear = GOval(150, 150, x=350, y=160)
    alien_rear.color = 'black'
    alien_rear.filled = True
    alien_rear.fill_color = 'limegreen'
    window.add(alien_rear)

    alien_cover_rear = GOval(150, 150, x=310, y=120)
    alien_cover_rear.color = 'white'
    alien_cover_rear.filled = True
    alien_cover_rear.fill_color = 'white'
    window.add(alien_cover_rear)

    alien_lhand = GOval(40, 40, x=180, y=380)
    alien_lhand.color = 'black'
    alien_lhand.filled = True
    alien_lhand.fill_color = 'limegreen'
    window.add(alien_lhand)

    alien_rhand = GOval(40, 40, x=380, y=380)
    alien_rhand.color = 'black'
    alien_rhand.filled = True
    alien_rhand.fill_color = 'limegreen'
    window.add(alien_rhand)

    alien_face = GOval(300, 270, x=150, y=150)
    alien_face.color = 'black'
    alien_face.filled = True
    alien_face.fill_color = 'limegreen'
    window.add(alien_face)

    alien_leye = GOval(70, 70, x=190, y=280)
    alien_leye.color = 'black'
    alien_leye.filled = True
    alien_leye.fill_color = 'white'
    window.add(alien_leye)

    alien_meye = GOval(70, 70, x=270, y=240)
    alien_meye.color = 'black'
    alien_meye.filled = True
    alien_meye.fill_color = 'white'
    window.add(alien_meye)

    alien_reye = GOval(70, 70, x=350, y=280)
    alien_reye.color = 'black'
    alien_reye.filled = True
    alien_reye.fill_color = 'white'
    window.add(alien_reye)

    lball = GOval(30, 30, x=220, y=310)
    lball.filled = True
    lball.fill_color = 'black'
    window.add(lball)

    mball = GOval(30, 30, x=290, y=275)
    mball.filled = True
    mball.fill_color = 'black'
    window.add(mball)

    rball = GOval(30, 30, x=360, y=310)
    rball.filled = True
    rball.fill_color = 'black'
    window.add(rball)

    b_triangle = GPolygon()
    b_triangle.add_vertex((290, 200))
    b_triangle.add_vertex((320, 200))
    b_triangle.add_vertex((305, 100))
    b_triangle.color = 'black'
    b_triangle.filled = True
    b_triangle.fill_color = 'limegreen'
    window.add(b_triangle)

    t_headline = GOval(30, 30, x=290, y=100)
    t_headline.color = 'black'
    t_headline.filled = True
    t_headline.fill_color = 'limegreen'
    window.add(t_headline)
Ejemplo n.º 18
0
def main():
    """
    Mike Wazowski is one of my fav characters in Monsters, Inc.
    because he is sooo cute and optimistic!
    """
    window = GWindow(width=800, height=800, title='Mike Wazowski sticker')

    # Mike's body
    body = GOval(400, 400, x=200, y=200)
    body.filled = True
    body.fill_color = "darkseagreen"
    body.color = "darkseagreen"
    window.add(body)

    # Mike's eyes
    white_eye = GOval(175, 175, x=320, y=250)
    white_eye.filled = True
    white_eye.fill_color = "white"
    white_eye.color = "white"
    window.add(white_eye)

    black_eye = GOval(100, 100, x=350, y=270)
    black_eye.filled = True
    window.add(black_eye)

    small_white_eye = GOval(25, 25, x=375, y=280)
    small_white_eye.filled = True
    small_white_eye.fill_color = "white"
    small_white_eye.color = "white"
    window.add(small_white_eye)
    # Mike's mouth
    mouth = GOval(200, 100, x=300, y=450)
    mouth.filled = True
    window.add(mouth)
    # Mike's teethes
    teeth_1 = GPolygon()
    teeth_1.add_vertex((330, 462))
    teeth_1.add_vertex((360, 454))
    teeth_1.add_vertex((355, 480))
    teeth_1.filled = True
    teeth_1.fill_color = "white"
    teeth_1.color = "white"
    window.add(teeth_1)

    teeth_2 = GPolygon()
    teeth_2.add_vertex((360, 454))
    teeth_2.add_vertex((390, 450))
    teeth_2.add_vertex((377, 480))
    teeth_2.filled = True
    teeth_2.fill_color = "white"
    teeth_2.color = "white"
    window.add(teeth_2)

    teeth_3 = GPolygon()
    teeth_3.add_vertex((390, 450))
    teeth_3.add_vertex((420, 450))
    teeth_3.add_vertex((410, 480))
    teeth_3.filled = True
    teeth_3.fill_color = "white"
    teeth_3.color = "white"
    window.add(teeth_3)

    teeth_4 = GPolygon()
    teeth_4.add_vertex((420, 450))
    teeth_4.add_vertex((450, 455))
    teeth_4.add_vertex((430, 480))
    teeth_4.filled = True
    teeth_4.fill_color = "white"
    teeth_4.color = "white"
    window.add(teeth_4)

    teeth_5 = GPolygon()
    teeth_5.add_vertex((450, 455))
    teeth_5.add_vertex((477, 465.5))
    teeth_5.add_vertex((460, 488))
    teeth_5.filled = True
    teeth_5.fill_color = "white"
    teeth_5.color = "white"
    window.add(teeth_5)

    teeth_6 = GPolygon()
    teeth_6.add_vertex((360, 548))
    teeth_6.add_vertex((390, 550))
    teeth_6.add_vertex((375, 530))
    teeth_6.filled = True
    teeth_6.fill_color = "white"
    teeth_6.color = "white"
    window.add(teeth_6)

    teeth_7 = GPolygon()
    teeth_7.add_vertex((390, 550))
    teeth_7.add_vertex((420, 550))
    teeth_7.add_vertex((405, 530))
    teeth_7.filled = True
    teeth_7.fill_color = "white"
    teeth_7.color = "white"
    window.add(teeth_7)

    teeth_8 = GPolygon()
    teeth_8.add_vertex((420, 550))
    teeth_8.add_vertex((450, 546))
    teeth_8.add_vertex((435, 530))
    teeth_8.filled = True
    teeth_8.fill_color = "white"
    teeth_8.color = "white"
    window.add(teeth_8)
    # Mike's legs
    left_leg = GPolygon()
    left_leg.add_vertex((340, 570))
    left_leg.add_vertex((345, 700))
    left_leg.add_vertex((360, 700))
    left_leg.add_vertex((365, 590))
    left_leg.filled = True
    left_leg.fill_color = "darkseagreen"
    left_leg.color = "darkseagreen"
    window.add(left_leg)

    right_leg = GPolygon()
    right_leg.add_vertex((460, 590))
    right_leg.add_vertex((465, 700))
    right_leg.add_vertex((480, 700))
    right_leg.add_vertex((485, 570))
    right_leg.filled = True
    right_leg.fill_color = "darkseagreen"
    right_leg.color = "darkseagreen"
    window.add(right_leg)

    left_sole = GPolygon()
    left_sole.add_vertex((310, 700))
    left_sole.add_vertex((360, 700))
    left_sole.add_vertex((310, 720))
    left_sole.filled = True
    left_sole.fill_color = "darkseagreen"
    left_sole.color = "darkseagreen"
    window.add(left_sole)

    right_sole = GPolygon()
    right_sole.add_vertex((465, 700))
    right_sole.add_vertex((515, 700))
    right_sole.add_vertex((515, 720))
    right_sole.filled = True
    right_sole.fill_color = "darkseagreen"
    right_sole.color = "darkseagreen"
    window.add(right_sole)

    left_toe_1 = GPolygon()
    left_toe_1.add_vertex((310, 700))
    left_toe_1.add_vertex((310, 706))
    left_toe_1.add_vertex((300, 703))
    left_toe_1.filled = True
    window.add(left_toe_1)

    left_toe_2 = GPolygon()
    left_toe_2.add_vertex((310, 706))
    left_toe_2.add_vertex((310, 713))
    left_toe_2.add_vertex((300, 710))
    left_toe_2.filled = True
    window.add(left_toe_2)

    left_toe_3 = GPolygon()
    left_toe_3.add_vertex((310, 713))
    left_toe_3.add_vertex((310, 720))
    left_toe_3.add_vertex((300, 715))
    left_toe_3.filled = True
    window.add(left_toe_3)

    right_toe_1 = GPolygon()
    right_toe_1.add_vertex((515, 700))
    right_toe_1.add_vertex((515, 706))
    right_toe_1.add_vertex((525, 703))
    right_toe_1.filled = True
    window.add(right_toe_1)

    right_toe_2 = GPolygon()
    right_toe_2.add_vertex((515, 706))
    right_toe_2.add_vertex((515, 713))
    right_toe_2.add_vertex((525, 710))
    right_toe_2.filled = True
    window.add(right_toe_2)

    right_toe_3 = GPolygon()
    right_toe_3.add_vertex((515, 713))
    right_toe_3.add_vertex((515, 720))
    right_toe_3.add_vertex((525, 715))
    right_toe_3.filled = True
    window.add(right_toe_3)
    # Mike's hands
    left_arm = GPolygon()
    left_arm.add_vertex((200, 400))
    left_arm.add_vertex((160, 510))
    left_arm.add_vertex((163, 520))
    left_arm.add_vertex((210, 445))
    left_arm.filled = True
    left_arm.fill_color = "darkseagreen"
    left_arm.color = "darkseagreen"
    window.add(left_arm)

    right_arm = GPolygon()
    right_arm.add_vertex((600, 400))
    right_arm.add_vertex((595, 445))
    right_arm.add_vertex((637, 520))
    right_arm.add_vertex((640, 510))
    right_arm.filled = True
    right_arm.fill_color = "darkseagreen"
    right_arm.color = "darkseagreen"
    window.add(right_arm)

    left_hand = GOval(30, 30, x=150, y=498)
    left_hand.filled = True
    left_hand.fill_color = "darkseagreen"
    left_hand.color = "darkseagreen"
    window.add(left_hand)

    right_hand = GOval(30, 30, x=632, y=507)
    right_hand.filled = True
    right_hand.fill_color = "darkseagreen"
    right_hand.color = "darkseagreen"
    window.add(right_hand)
    # Mike's ears
    left_ear = GPolygon()
    left_ear.add_vertex((300, 230))
    left_ear.add_vertex((320, 230))
    left_ear.add_vertex((310, 190))
    left_ear.filled = True
    left_ear.fill_color = "darkseagreen"
    left_ear.color = "darkseagreen"
    window.add(left_ear)

    right_ear = GPolygon()
    right_ear.add_vertex((475, 230))
    right_ear.add_vertex((495, 230))
    right_ear.add_vertex((485, 190))
    right_ear.filled = True
    right_ear.fill_color = "darkseagreen"
    right_ear.color = "darkseagreen"
    window.add(right_ear)
    # texts
    label = GLabel("Uhhhh...", x=270, y=145)
    label.font = "Comic Sans MS-70-bold"
    label.color = "black"
    window.add(label)
Ejemplo n.º 19
0
def peach():
    p_face1 = GPolygon()
    p_face1.add_vertex((750, 155))
    p_face1.add_vertex((670, 225))
    p_face1.add_vertex((835, 210))
    window.add(p_face1)
    p_face1.color = 'peach'
    p_face1.fill_color = 'peach'
    p_face2 = GOval(190, 140)
    window.add(p_face2, x=665, y=180)
    p_face2.color = 'peach'
    p_face2.fill_color = 'peach'

    p_l_eye = GOval(30, 30)
    window.add(p_l_eye, x=705, y=215)
    p_l_eye.filled = True
    p_l_eye.fill_color = 'darkgray2'
    p_l_eye2 = GOval(12, 12)
    window.add(p_l_eye2, x=708, y=220)
    p_l_eye2.filled = True
    p_l_eye2.fill_color = 'ivory'
    p_l_eye3 = GOval(9, 9)
    window.add(p_l_eye3, x=723, y=224)
    p_l_eye3.filled = True
    p_l_eye3.fill_color = 'ivory'
    p_l_eye4 = GOval(9, 9)
    window.add(p_l_eye4, x=717, y=232)
    p_l_eye4.filled = True
    p_l_eye4.fill_color = 'ivory'

    p_r_eye = GOval(30, 30)
    window.add(p_r_eye, x=785, y=215)
    p_r_eye.filled = True
    p_r_eye.fill_color = 'darkgray2'
    p_r_eye2 = GOval(12, 12)
    window.add(p_r_eye2, x=788, y=220)
    p_r_eye2.filled = True
    p_r_eye2.fill_color = 'ivory'
    p_r_eye3 = GOval(9, 9)
    window.add(p_r_eye3, x=803, y=224)
    p_r_eye3.filled = True
    p_r_eye3.fill_color = 'ivory'
    p_r_eye4 = GOval(9, 9)
    window.add(p_r_eye4, x=797, y=232)
    p_r_eye4.filled = True
    p_r_eye4.fill_color = 'ivory'

    p_mouth_1 = GOval(35, 30)
    window.add(p_mouth_1, x=730, y=260)
    p_mouth_1.color = 'firebrick'
    p_mouth_1.filled = True
    p_mouth_1.fill_color = 'firebrick'
    p_mouth_2 = GOval(35, 30)
    window.add(p_mouth_2, x=755, y=260)
    p_mouth_2.color = 'firebrick'
    p_mouth_2.filled = True
    p_mouth_2.fill_color = 'firebrick'
    p_mouth_3 = GOval(40, 12)
    window.add(p_mouth_3, x=740, y=280)
    p_mouth_3.color = 'firebrick'
    p_mouth_3.filled = True
    p_mouth_3.fill_color = 'firebrick'
    p_teeth = GOval(25, 25)
    window.add(p_teeth, x=747, y=250)
    p_teeth.color = 'ivory'
    p_teeth.filled = True
    p_teeth.fill_color = 'ivory'
    p_mouth_4 = GOval(40, 15)
    window.add(p_mouth_4, x=740, y=248)
    p_mouth_4.color = 'peach'
    p_mouth_4.filled = True
    p_mouth_4.fill_color = 'peach'

    p_l_cheek = GOval(35, 15)
    window.add(p_l_cheek, x=675, y=250)
    p_l_cheek.color = 'pink2'
    p_l_cheek.fill_color = 'pink2'
    p_r_cheek = GOval(35, 15)
    window.add(p_r_cheek, x=805, y=250)
    p_r_cheek.color = 'pink2'
    p_r_cheek.fill_color = 'pink2'

    peach_name = GLabel('APEACH')
    peach_name.font = 'Verdana-30-bold'
    window.add(peach_name, x=695, y=380)
Ejemplo n.º 20
0
def main():
    """
    TODO:
    """
    window = GWindow(width=1200, height=600)
    body = GRect(200, 300, x=200, y=150)
    head = GOval(200, 200, x=200, y=50)
    eye = GOval(170, 120, x=250, y=130)
    left_foot = GRect(80, 100, x=200, y=450)
    right_foot = GRect(80, 100, x=320, y=450)
    back = GPolygon()
    back.add_vertex((200, 200))
    back.add_vertex((130, 220))
    back.add_vertex((130, 400))
    back.add_vertex((200, 400))
    handle_1 = GRect(40, 100, x=500, y=250)
    handle_2 = GRect(80, 40, x=420, y=280)
    knife = GPolygon()
    knife.add_vertex((540, 280))
    knife.add_vertex((570, 260))
    knife.add_vertex((590, 275))
    knife.add_vertex((610, 265))
    knife.add_vertex((640, 315))
    knife.add_vertex((540, 315))

    head.filled = True
    body.filled = True
    eye.filled = True
    back.filled = True
    handle_1.filled = True
    left_foot.filled = True
    right_foot.filled = True
    handle_2.filled = True
    knife.filled = True

    head.fill_color = 'red'
    body.fill_color = 'red'
    eye.fill_color = 'skyblue'
    left_foot.fill_color = 'red'
    right_foot.fill_color = 'red'
    back.fill_color = 'red'
    handle_1.fill_color = 'black'
    handle_2.fill_color = 'black'
    knife.fill_color = 'grey'

    head.color = 'red'
    body.color = 'red'
    left_foot.color = 'red'
    right_foot.color = 'red'

    window.add(body)
    window.add(head)
    window.add(eye)
    window.add(left_foot)
    window.add(right_foot)
    window.add(back)
    window.add(handle_1)
    window.add(handle_2)
    window.add(knife)

    body2 = GRect(200, 300, x=750, y=150)
    head2 = GOval(200, 200, x=750, y=50)
    eye2 = GOval(170, 120, x=730, y=130)
    left_foot2 = GRect(80, 100, x=750, y=450)
    right_foot2 = GRect(80, 100, x=870, y=450)
    back2 = GPolygon()
    back2.add_vertex((950, 200))
    back2.add_vertex((1020, 220))
    back2.add_vertex((1020, 400))
    back2.add_vertex((950, 400))

    knife2 = GPolygon()
    knife2.add_vertex((700, 200))
    knife2.add_vertex((680, 180))
    knife2.add_vertex((650, 200))
    knife2.add_vertex((650, 400))
    knife2.add_vertex((700, 400))

    head2.filled = True
    body2.filled = True
    eye2.filled = True
    back2.filled = True
    left_foot2.filled = True
    right_foot2.filled = True

    knife2.filled = True

    head2.fill_color = 'purple'
    body2.fill_color = 'purple'
    eye2.fill_color = 'skyblue'
    left_foot2.fill_color = 'purple'
    right_foot2.fill_color = 'purple'
    back2.fill_color = 'purple'
    knife2.fill_color = 'brown'

    head2.color = 'purple'
    body2.color = 'purple'
    left_foot2.color = 'purple'
    right_foot2.color = 'purple'
    knife2.color = 'brown'

    window.add(body2)
    window.add(head2)
    window.add(eye2)
    window.add(left_foot2)
    window.add(right_foot2)
    window.add(back2)

    label = GLabel('Among Us', x=450, y=500)
    label.font = 'Courier-50-italic'
    window.add(label)

    window.add(knife2)
    def set_opening(self):
        """
        This method set up the whole opening scene.
        """

        # To create the tube
        start_button_1 = GRect(60, 211, x=(self.window.width - 60) / 2, y=-1)
        start_button_1.color = 'slategrey'
        start_button_1.filled = True
        start_button_1.fill_color = 'slategrey'
        start_button_2 = GRect(50, 206, x=(self.window.width - 50) / 2)
        start_button_2.color = 'gainsboro'
        start_button_2.filled = True
        start_button_2.fill_color = 'gainsboro'
        self.window.add(start_button_1)
        self.window.add(start_button_2)
        head = GPolygon()
        head.add_vertex(((self.window.width - 60) / 2, 210))
        head.add_vertex(((self.window.width - 60) / 2 + 60, 210))
        head.add_vertex(((self.window.width - 60) / 2 + 60 + 20, 240))
        head.add_vertex(((self.window.width - 60) / 2 - 20, 240))
        head.color = 'slategrey'
        head.filled = True
        head.fill_color = 'slategrey'
        self.window.add(head)

        # Loading animation
        for i in range(10):
            load = GRect(40,
                         15,
                         x=(self.window.width - 60) / 2 + 10,
                         y=5 + 20 * i)
            load.filled = 'True'
            load.color = 'slategrey'
            load.fill_color = 'slategrey'
            self.window.add(load)
            pause(100)

        # Bouncing ball
        self.o_ball.filled = 'True'
        self.o_ball.color = 'crimson'
        self.o_ball.fill_color = 'crimson'
        self.window.add(self.o_ball)
        ball_vy = 5
        count = 0
        while True:
            self.o_ball.move(0, ball_vy)
            ball_vy += 1
            if self.o_ball.y + 30 >= self.window.height:
                ball_vy *= -0.9
                count += 1
            if count == 5 and ball_vy >= 0:
                break
            pause(10)
        self.window.remove(self.o_ball)

        # Blowing balloon animation
        for i in range(55):
            self.o_ball = GOval(30 + i,
                                30 + i,
                                x=(self.window.width - 30 + i) / 2 - i,
                                y=415 - i)
            self.o_ball.filled = 'True'
            self.o_ball.color = 'crimson'
            self.o_ball.fill_color = 'crimson'
            self.window.add(self.o_ball)
            pause(7)

        # Flashing start sign animation
        for i in range(10):
            self.start_button.font = 'Mamelon-20'
            if i % 2 == 0:
                self.start_button.color = 'crimson'
            else:
                self.start_button.color = 'snow'
            self.window.add(self.o_ball)
            self.window.add(self.start_button,
                            x=(self.window.width - 64) / 2,
                            y=413)
            pause(100)

        # Show the rules
        rule_1 = GLabel('3 LIVES.')
        rule_1.color = 'darkslategrey'
        rule_1.font = 'Mamelon-20'
        rule_2 = GLabel("CATCH '    ' FOR RANDOM EFFECTS.")
        rule_2.color = 'darkslategrey'
        rule_2.font = 'Mamelon-20'
        rule_3 = GLabel('SCORE 1000 ---> FIREWORKS.')
        rule_3.color = 'crimson'
        rule_3.font = 'Mamelon-20'
        square = GRect(10,
                       10,
                       x=self.window.width / 10 + 63,
                       y=self.window.height * 4 // 5 + 10)
        square.filled = True
        square.fill_color = 'darkslateblue'
        square.color = 'darkslateblue'
        self.window.add(square)
        self.window.add(rule_1,
                        x=self.window.width / 10,
                        y=self.window.height * 4 // 5)
        self.window.add(rule_2,
                        x=self.window.width / 10,
                        y=self.window.height * 4 // 5 + 25)
        self.window.add(rule_3,
                        x=self.window.width / 10,
                        y=self.window.height * 4 // 5 + 50)