Beispiel #1
0
def face(r,cx,cy):
  faceWin = graphics.GraphWin()

  head=graphics.Circle(graphics.Point(cx,cy),r)
  head.setFill("tan")
  head.draw(faceWin)

# oval eyes
  p1 = graphics.Point(cx-.5*cx, cy-.5*cy)
  p2 = graphics.Point(cx-(3/10)*cx, cy)
  eye1 = graphics.Oval(p1, p2)
  eye1.setFill("black")
  eye1.draw(faceWin)

  p3 = graphics.Point((63/100)*cx, (60/100*cy))
  eye1dot = graphics.Circle(p3, (5/100)*r)
  eye1dot.setFill("white")
  eye1dot.draw(faceWin)

  eye2 = eye1.clone()
  eye2.move((7/10*cx),0)
  eye2.draw(faceWin)

  eye2dot = eye1dot.clone()
  eye2dot.move((7/10)*cx,0)
  eye2dot.draw(faceWin)

  mp1=graphics.Point((65/100)*cx,(11/10)*cy)
  mp2 = graphics.Point((135/100)*cx,(14/10)*cy)
  mouth= graphics.Oval(mp1,mp2)
  mouth.setFill("pink")
  mouth.draw(faceWin)
def draw_clouds(win):
    cloud = gr.Oval(gr.Point(20, 100), gr.Point(500, 50))
    cloud.draw(win)
    cloud.setFill('#48494B')

    cloud = gr.Oval(gr.Point(280, 80), gr.Point(610, 25))
    cloud.draw(win)
    cloud.setFill('#777B7E')

    cloud = gr.Oval(gr.Point(370, 140), gr.Point(800, 100))
    cloud.draw(win)
    cloud.setFill('#777B7E')
Beispiel #3
0
def dr_ship():
    """
    Draw daring ship with white sail
    """
    ship1 = gr.Line(gr.Point(130, 300), gr.Point(275, 300))
    ship1.setWidth(18)
    ship1.setOutline('brown')
    ship1.draw(window)

    ship2 = gr.Line(gr.Point(140, 318), gr.Point(265, 318))
    ship2.setWidth(18)
    ship2.setOutline('brown')
    ship2.draw(window)

    ship3 = gr.Line(gr.Point(140, 309), gr.Point(265, 309))
    ship3.setOutline('black')
    ship3.draw(window)

    ship4 = gr.Line(gr.Point(150, 336), gr.Point(255, 336))
    ship4.setWidth(18)
    ship4.setOutline('brown')
    ship4.draw(window)

    ship5 = gr.Line(gr.Point(140, 327), gr.Point(265, 327))
    ship5.setOutline('black')
    ship5.draw(window)

    ship6 = gr.Line(gr.Point(200, 300), gr.Point(200, 200))
    ship6.setWidth(5)
    ship6.setOutline('brown')
    ship6.draw(window)

    sail = gr.Oval(gr.Point(190, 285), gr.Point(220, 210))
    sail.setFill('white')
    sail.draw(window)
Beispiel #4
0
def draw_car(win):
    pipe = gr.Oval(gr.Point(160, 595), gr.Point(320, 605))
    pipe.setOutline(gr.color_rgb(0, 0, 0))
    pipe.setFill(gr.color_rgb(0, 0, 0))
    pipe.draw(win)

    body1 = gr.Rectangle(gr.Point(180, 570), gr.Point(400, 610))
    body1.setOutline(gr.color_rgb(80, 200, 250))
    body1.setFill(gr.color_rgb(80, 200, 250))
    body1.draw(win)

    body2 = gr.Rectangle(gr.Point(230, 540), gr.Point(350, 570))
    body2.setOutline(gr.color_rgb(80, 200, 250))
    body2.setFill(gr.color_rgb(80, 200, 250))
    body2.draw(win)

    draw_window(240, 550, 280, 575)
    draw_window(300, 550, 340, 575)

    draw_wheel(210, 595, 250, 625)
    draw_wheel(330, 595, 370, 625)

    draw_smoke(80, 580, 150, 610)
    draw_smoke(50, 540, 120, 570)
    draw_smoke(20, 500, 90, 530)
Beispiel #5
0
def draw_nature():
    sea = gr.Line(gr.Point(0, 250), gr.Point(400, 250))
    sea.setWidth(200)
    sea.setOutline('deepskyblue')

    island = gr.Circle(gr.Point(200, 1175), 900)
    island.setFill('gold')
    island.setOutline('gold')

    stone = gr.Oval(gr.Point(30, 355), gr.Point(120, 320))
    stone.setFill('lightgray')
    stone.setOutline("lightgray")

    sun = gr.Circle(gr.Point(400, 0), 40)
    sun.setFill('yellow')
    sun.setOutline('yellow')

    def draw_cloud(k, m):
        circle_centers = [(k, m), (k + 20, m), (k - 15, m + 20),
                          (k + 10, m + 20), (k + 35, m + 20)]
        for k, m in circle_centers:
            circle = gr.Circle(gr.Point(k, m), 20)
            circle.setFill('white')
            circle.setOutline('white')
            circle.draw(window)

    for q, w in [(40, 30), (120, 80), (230, 30)]:
        draw_cloud(q, w)

    sea.draw(window)
    sun.draw(window)
    island.draw(window)
    stone.draw(window)
 def __init__(self, win, r, h, tar_wid, tar_max_vel, tar_acc):
     self.center = r - tar_wid // 2
     self.ov = graphics.Oval(graphics.Point(r - tar_wid, h),
                             graphics.Point(r, h + 5))
     self.ov.draw(win)
     self.max_vel = tar_max_vel
     self.acc = tar_acc
     self.xvel0 = 0.0
Beispiel #7
0
def second_tree():
    stvol2 = gr.Rectangle(gr.Point(90, 330), gr.Point(120, 430))
    stvol2.setFill('brown')
    krona2 = gr.Oval(gr.Point(60, 350), gr.Point(150, 180))
    krona2.setFill('green')

    stvol2.draw(window)
    krona2.draw(window)
Beispiel #8
0
def draw_tree():
    stvol = gr.Rectangle(gr.Point(50, 360), gr.Point(80, 460))
    stvol.setFill('brown')
    krona = gr.Oval(gr.Point(20, 380), gr.Point(110, 210))
    krona.setFill('green')

    stvol.draw(window)
    krona.draw(window)
def body_fish(c_fish):
    body = gr.Oval(gr.Point(c_fish.x - 50, c_fish.y - 20),
                   gr.Point(c_fish.x, c_fish.y + 20))
    body.setFill('Green')
    body.setOutline('Green')

    body.draw(w)

    fish.append(body)
Beispiel #10
0
def draw_reed(x, y):
    reed_1 = gr.Rectangle(gr.Point(x, y), gr.Point(x + 5, y - 150))
    reed_1.setFill('Brown')
    reed_1.setOutline('Brown')
    reed_2 = gr.Oval(gr.Point(x - 3, y - 145), gr.Point(x + 8, y - 195))
    reed_2.setFill('Black')

    reed_1.draw(w)
    reed_2.draw(w)
Beispiel #11
0
def test_graphics2():
    import graphics2 as graphics
    win = graphics.GraphWin("My Circle", 1500, 600)
    c = graphics.Oval(graphics.Point(50, 50), graphics.Point(120, 100))
    c.draw(win)
    c.setFill("purple")
    win.plot(30, 30, "blue")
    win.getMouse()  # pause for click in window
    win.close()
Beispiel #12
0
def draw_eye():
    eye1 = gr.Circle(gr.Point(150, 180), 20)
    eye1.setFill('yellow')
    eye_center2 = gr.Oval(gr.Point(130, 190), gr.Point(170, 170))
    eye1_center = gr.Circle(gr.Point(150, 180), 8)
    eye1_center.setFill('black')
    eye_center2.setFill('red')
    eye1.draw(window)
    eye_center2.draw(window)
    eye1_center.draw(window)
Beispiel #13
0
def drawOval(width, height):
    """Draws an oval defined by the bounding box of given size,
    using current graphics pen point as the top left corner of the bounding box.
    Does not move the pen point.
    @param width Width of oval
    @param height Height of oval
    """
    _addObjectToCanvas(graphics.Oval(_current_point, \
                                     graphics.Point(_current_point.x + width, \
                                                    _current_point.y + height)))
def draw_fish():
    draw_polygon([[550, 620], [640, 570], [650, 620]], 'red')  # fish_fin1
    draw_polygon([[550, 680], [640, 730], [650, 680]], 'red')  # fish_fin2

    fish_body = gr.Oval(gr.Point(500, 600), gr.Point(700, 700))
    draw(fish_body, 'red')

    draw_polygon([[700, 650], [750, 700], [750, 600]], 'red')  # fish_tail

    fish_eye = gr.Circle(gr.Point(550, 650), 10)
    draw(fish_eye, 'black')
Beispiel #15
0
def draw_lake():
    lake = gr.Oval(gr.Point(400, 550), gr.Point(650, 450))
    lake.setFill('Blue')
    lake.setOutline('Blue')
    x = 650
    y = 500
    for i in range(7):
        draw_reed(x, y)
        x = x + 15
        y = y + 40 * (-1)**i
    lake.draw(w)
    def drawBullet(self):
        #RED OVAL THAT IS THE HEAD OF THE BULLET
        self.bullet_body=g.Oval(g.Point(self.x,self.y),g.Point(self.x+5,self.y+15))
        self.bullet_body.setFill('red')
        self.bullet_body.setOutline('black')

        #THIS IS THE BLACK RECTANGLE ON TOP OF THE RED OVAL (SHELL)
        self.bullet_shell=g.Rectangle(g.Point(self.x,self.y+7.5),g.Point(self.x+5,self.y+22))
        self.bullet_shell.setFill('black')
        
        #DRAWING THE BULLET
        self.bullet_body.draw(self.w)
        self.bullet_shell.draw(self.w)
Beispiel #17
0
def draw_mountain_at_the_middle(win):
    """Draws mountain at the middle"""
    mountain_at_the_middle = gr.Polygon(gr.Point(0, 416), gr.Point(31, 415),
                                        gr.Point(48, 432), gr.Point(133, 500),
                                        gr.Point(179, 444), gr.Point(228, 471),
                                        gr.Point(243, 390), gr.Point(295, 406),
                                        gr.Point(327, 450), gr.Point(438, 428),
                                        gr.Point(498, 362), gr.Point(632, 432),
                                        gr.Point(687, 383), gr.Point(723, 405),
                                        gr.Point(768, 375), gr.Point(812, 394),
                                        gr.Point(900, 303), gr.Point(900, 540),
                                        gr.Point(0, 540))
    mountain_top = gr.Oval(gr.Point(50, 350), gr.Point(140, 540))
    mountain_top.setFill(gr.color_rgb(172, 67, 52))
    mountain_top.setOutline(gr.color_rgb(172, 67, 52))
    mountain_top_2 = gr.Oval(gr.Point(439, 357), gr.Point(525, 495))
    mountain_top_2.setFill(gr.color_rgb(172, 67, 52))
    mountain_top_2.setOutline(gr.color_rgb(172, 67, 52))
    mountain_at_the_middle.setFill(gr.color_rgb(172, 67, 52))
    mountain_at_the_middle.setOutline(gr.color_rgb(172, 67, 52))
    mountain_at_the_middle.draw(win)
    mountain_top.draw(win)
    mountain_top_2.draw(win)
Beispiel #18
0
def tree(x1, y1, x2, y2):
    dx = x2 - x1
    dy = y2 - y1

    trunk = gr.Rectangle(gr.Point(x1 + dx * (1 / 2 - 1 / 20), y1 + dy / 2),
                         gr.Point(x1 + dx * (1 / 2 + 1 / 30), y2))
    trunk.setFill('lightblue')
    trunk.setOutline('lightblue')
    trunk.draw(window)

    leafs = gr.Oval(gr.Point(x1 + dx * (1 / 2 - 7 / 24), y1),
                    gr.Point(x1 + dx * (1 / 2 + 7 / 24), y1 + dy * 5 / 12))
    leafs.setFill('darkgreen')
    leafs.setOutline('darkgreen')
    leafs.draw(window)

    leafs = gr.Oval(gr.Point(x1, y1 + dy / 4),
                    gr.Point(x2, y1 + dy * (1 / 2 + 1 / 8)))
    leafs.setFill('darkgreen')
    leafs.setOutline('darkgreen')
    leafs.draw(window)

    leafs = gr.Oval(
        gr.Point(x1 + dx * (1 / 2 - 7 / 24), y1 + dy * (1 / 2 + 1 / 16)),
        gr.Point(x1 + dx * (1 / 2 + 7 / 24), y1 + dy * 4 / 5))
    leafs.setFill('darkgreen')
    leafs.setOutline('darkgreen')
    leafs.draw(window)

    fruit = gr.Oval(gr.Point(x1 + dx * 13 / 24, y1 + dy * 3 / 36),
                    gr.Point(x1 + dx * 17 / 24, y1 + dy * 6 / 36))
    fruit.setFill('yellow')
    fruit.setOutline('yellow')
    fruit.draw(window)

    fruit = gr.Oval(gr.Point(x1 + dx * 19 / 24, y1 + dy * 15 / 36),
                    gr.Point(x1 + dx * 23 / 24, y1 + dy * 18 / 36))
    fruit.setFill('yellow')
    fruit.setOutline('yellow')
    fruit.draw(window)

    fruit = gr.Oval(gr.Point(x1 + dx * 1 / 24, y1 + dy * 15 / 36),
                    gr.Point(x1 + dx * 5 / 24, y1 + dy * 18 / 36))
    fruit.setFill('yellow')
    fruit.setOutline('yellow')
    fruit.draw(window)

    fruit = gr.Oval(gr.Point(x1 + dx * 13 / 24, y1 + dy * 24 / 36),
                    gr.Point(x1 + dx * 17 / 24, y1 + dy * 27 / 36))
    fruit.setFill('yellow')
    fruit.setOutline('yellow')
    fruit.draw(window)
Beispiel #19
0
def draw_background(win):
    """Draw sky and ground"""
    sky = gr.Rectangle(gr.Point(0, 0), gr.Point(600, 445))
    sky.setOutline(gr.color_rgb(210, 210, 210))
    sky.setFill(gr.color_rgb(210, 210, 210))
    sky.draw(win)

    ground = gr.Rectangle(gr.Point(0, 450), gr.Point(600, 1000))
    ground.setFill(gr.color_rgb(120, 120, 120))
    ground.setOutline(gr.color_rgb(120, 120, 120))
    ground.draw(win)

    puddle = gr.Oval(gr.Point(0, 530), gr.Point(1000, 1000))
    puddle.setFill(gr.color_rgb(190, 190, 200))
    puddle.setOutline(gr.color_rgb(190, 190, 200))
    puddle.draw(win)
 def create(self):
     #creating enemy
     self.p = g.Polygon(g.Point(self.x, self.y),
                        g.Point(self.x + 80, self.y),
                        g.Point(self.x + 40, self.y + 80))
     self.e = g.Oval(g.Point(self.x + 15, self.y + 10),
                     g.Point(self.x + 60, self.y + 40))
     self.c = g.Circle(
         g.Point(self.e.getCenter().getX(),
                 self.e.getCenter().getY()), 10)
     #coloring enemy
     self.p.setFill('blue')
     self.e.setFill('white')
     self.c.setFill('red')
     #draw enemy
     for obj in [self.p, self.e, self.c]:
         obj.draw(self.w)
def tail_fish(c_fish):
    tail_1 = gr.Polygon(gr.Point(c_fish.x - 50, c_fish.y),
                        gr.Point(c_fish.x - 70, c_fish.y - 20),
                        gr.Point(c_fish.x - 70, c_fish.y + 20))
    tail_1.setOutline('Red')
    tail_1.setFill('Red')

    tail_2 = gr.Oval(gr.Point(c_fish.x - 65, c_fish.y + 20),
                     gr.Point(c_fish.x - 85, c_fish.y - 20))
    tail_2.setFill('Navy')
    tail_2.setOutline('Navy')

    tail_1.draw(w)
    tail_2.draw(w)

    fish.append(tail_1)
    fish.append(tail_2)
Beispiel #22
0
def blind_test(f):
    if f:
        import graphics2 as graphics
    else:
        import graphics
    win = graphics.GraphWin("My Circle", 1500, 600)
    c = graphics.Oval(graphics.Point(50, 50), graphics.Point(140, 100))
    c.draw(win)
    c.setFill("purple")
    win.plot(30, 30, "blue")
    for i in range(100):
        c.move(1, 1)
    f = graphics.Circle(graphics.Point(400, 400), 70)
    f.setWidth("30")
    f.draw(win)
    k = graphics.Polygon(graphics.Point(40, 40), graphics.Point(40, 80),
                         graphics.Point(80, 40))
    k.draw(win)
    win.getMouse()  # pause for click in window
    win.close()
Beispiel #23
0
    def graphics(self):
        win = graphics.GraphWin('Task #1: Graphics', 600, 600)
        win.setBackground("white")

        win.setCoords(0, 0, 500, 500)

        for i in range(1, 6):
            rect = graphics.Rectangle(
                graphics.Point(150 + 16 * i, 480 - 16 * i),
                graphics.Point(350 - 16 * i, 280 + 16 * i))
            rect.setFill(self.colors[i - 1])
            rect.draw(win)

        for i in range(1, 6):
            oval = graphics.Oval(graphics.Point(120 + 16 * i, 280 - 16 * i),
                                 graphics.Point(380 - 16 * i, 80 + 16 * i))
            oval.setFill(self.colors[i - 1])
            oval.draw(win)

        win.getMouse()
        win.close()
Beispiel #24
0
def draw_fish():

    fish_fin1 = gr.Polygon(gr.Point(550, 620), gr.Point(640, 570), gr.Point(650, 620))
    fish_fin1.draw(window)
    fish_fin1.setFill('red')

    fish_fin2 = gr.Polygon(gr.Point(550, 680), gr.Point(640, 730), gr.Point(650, 680))
    fish_fin2.draw(window)
    fish_fin2.setFill('red')

    fish_body = gr.Oval(gr.Point(500, 600), gr.Point(700, 700))
    fish_body.draw(window)
    fish_body.setFill('red')

    fish_tail = gr.Polygon(gr.Point(700, 650), gr.Point(750, 700), gr.Point(750, 600))
    fish_tail.draw(window)
    fish_tail.setFill('red')

    fish_eye = gr.Circle(gr.Point(550, 650), 10)
    fish_eye.draw(window)
    fish_eye.setFill('black')
def main():
    win = g.GraphWin('Face', 200, 150) # give title and dimensions
    #win.yUp() # make right side up coordinates!

    eye1 = g.Circle(g.Point(5, 5), 5)
    eye1.setFill('red')
    eye1.draw(win)
    eye1 = g.Circle(g.Point(194, 5), 5)
    eye1.setFill('blue')
    eye1.draw(win)
    eye1 = g.Circle(g.Point(5, 100), 5)
    eye1.setFill('yellow')
    eye1.draw(win)
    eye1 = g.Circle(g.Point(194, 100), 5)
    eye1.setFill('green')
    eye1.draw(win)
    
    head = g.Circle(g.Point(40,100), 25) # set center and radius
    head.setFill("yellow")
    head.draw(win)

    eye1 = g.Circle(g.Point(30, 105), 5)
    eye1.setFill('blue')
    eye1.draw(win)

    eye2 = g.Line(g.Point(45, 105), g.Point(55, 105)) # set endpoints
    eye2.setWidth(3)
    eye2.draw(win)

    mouth = g.Oval(g.Point(30, 90), g.Point(50, 85)) # set corners of bounding box
    mouth.setFill("red")
    mouth.draw(win)

    label = g.Text(g.Point(100, 120), 'A face')
    label.draw(win)

    message = g.Text(g.Point(win.getWidth()/2, 20), 'Click anywhere to quit.')
    message.draw(win)
    win.getMouse()
    win.close()
Beispiel #26
0
def main():
    win = g.GraphWin("Geometrische Objekte in graphics.py", WIDTH, HEIGHT)

    # Linien
    drawGrid(win)

    # Rechteck
    rect = g.Rectangle(g.Point(20, 20), g.Point(120, 120))
    rect.setFill(g.color_rgb(255, 127, 36))
    rect.setOutline("black")
    rect.draw(win)

    # Kreis
    circ = g.Circle(g.Point(190, 70), 50)
    circ.setFill(g.color_rgb(107, 142, 35))
    circ.setOutline("black")
    circ.draw(win)

    # Oval
    oval = g.Oval(g.Point(260, 20), g.Point(380, 240))
    oval.setFill(g.color_rgb(193, 205, 193))
    oval.setOutline("black")
    oval.draw(win)

    # Dreieick
    tri1 = g.Polygon(g.Point(20, 140), g.Point(120, 240), g.Point(20, 240))
    tri1.setFill(g.color_rgb(255, 236, 139))
    tri1.setOutline("black")
    tri1.draw(win)

    # Sechseck
    hexa = g.Polygon(g.Point(190, 140), g.Point(240, 165), g.Point(240, 215),
                     g.Point(190, 240), g.Point(140, 215), g.Point(140, 165))
    hexa.setFill(g.color_rgb(204, 53, 100))
    hexa.setOutline("black")
    hexa.draw(win)

    win.getMouse()  # Pause to view result
    win.close()  # Close window when done
Beispiel #27
0
def draw_nature():
    sea = gr.Line(gr.Point(0, 250), gr.Point(400, 250))
    sea.setWidth(200)
    sea.setOutline('deepskyblue')

    island = gr.Circle(gr.Point(200, 1175), 900)
    island.setFill('gold')
    island.setOutline('gold')

    stone = gr.Oval(gr.Point(30, 355), gr.Point(120, 320))
    stone.setFill('lightgray')
    stone.setOutline("lightgray")

    sun = gr.Circle(gr.Point(400, 0), 40)
    sun.setFill('yellow')
    sun.setOutline('yellow')

    def draw_cloud(centre_circle_x, centre_circle_y):
        circle_centers = [(centre_circle_x, centre_circle_y),
                          (centre_circle_x + 20, centre_circle_y),
                          (centre_circle_x - 15, centre_circle_y + 20),
                          (centre_circle_x + 10, centre_circle_y + 20),
                          (centre_circle_x + 35, centre_circle_y + 20)]
        for centre_circle_x, centre_circle_y in circle_centers:
            circle = gr.Circle(gr.Point(centre_circle_x, centre_circle_y), 20)
            circle.setFill('white')
            circle.setOutline('white')
            circle.draw(window)

    for circles_x, circles_y in [(40, 30), (120, 80), (230, 30)]:
        draw_cloud(circles_x, circles_y)

    sea.draw(window)
    sun.draw(window)
    island.draw(window)
    stone.draw(window)
Beispiel #28
0
def ilermanaty():
    """Creates a window with the beautiful "ilermanaty" drawing."""
    win = graphics.GraphWin('ilermanaty', 300, 300)

    # Draw a triangle
    triangle = graphics.Polygon(
        [graphics.Point(x, y) for x, y in ((150, 30), (40, 230), (260, 230))])
    triangle.setOutline('DarkSeaGreen')

    # Draw an oval
    eye = graphics.Oval(graphics.Point(80, 130), graphics.Point(220, 210))
    eye.setFill('DarkSeaGreen')

    eyeball = graphics.Circle(eye.getCenter(), 24)
    eyeball.setFill('Black')

    text = graphics.Text(graphics.Point(150, 270), _get_text())
    text.setSize(14)

    triangle.draw(win)
    eye.draw(win)
    eyeball.draw(win)
    text.draw(win)
    return win
Beispiel #29
0
def draw_nature():
    sea = gr.Line(gr.Point(0, 250), gr.Point(400, 250))
    sea.setWidth(200)
    sea.setOutline('deepskyblue')

    island = gr.Circle(gr.Point(200, 1175), 900)
    island.setFill('gold')
    island.setOutline('gold')

    stone = gr.Oval(gr.Point(230, 355), gr.Point(320, 320))
    stone.setFill('lightgray')
    stone.setOutline("lightgray")

    sun = gr.Circle(gr.Point(0, 0), 40)
    sun.setFill('yellow')
    sun.setOutline('yellow')

    def draw_cloud_1():
        cloud1 = gr.Circle(gr.Point(60, 30), 20)
        cloud1.setFill('white')
        cloud1.setOutline('white')

        cloud2 = gr.Circle(gr.Point(80, 30), 20)
        cloud2.setFill('white')
        cloud2.setOutline('white')

        cloud3 = gr.Circle(gr.Point(45, 50), 20)
        cloud3.setFill('white')
        cloud3.setOutline('white')

        cloud4 = gr.Circle(gr.Point(70, 50), 20)
        cloud4.setFill('white')
        cloud4.setOutline('white')

        cloud5 = gr.Circle(gr.Point(95, 50), 20)
        cloud5.setFill('white')
        cloud5.setOutline('white')

        cloud1.draw(window)
        cloud2.draw(window)
        cloud3.draw(window)
        cloud4.draw(window)
        cloud5.draw(window)

    def draw_cloud_2():
        cloud6 = gr.Circle(gr.Point(140, 80), 20)
        cloud6.setFill('white')
        cloud6.setOutline('white')

        cloud7 = gr.Circle(gr.Point(160, 80), 20)
        cloud7.setFill('white')
        cloud7.setOutline('white')

        cloud8 = gr.Circle(gr.Point(125, 100), 20)
        cloud8.setFill('white')
        cloud8.setOutline('white')

        cloud9 = gr.Circle(gr.Point(150, 100), 20)
        cloud9.setFill('white')
        cloud9.setOutline('white')

        cloud10 = gr.Circle(gr.Point(175, 100), 20)
        cloud10.setFill('white')
        cloud10.setOutline('white')

        cloud6.draw(window)
        cloud7.draw(window)
        cloud8.draw(window)
        cloud9.draw(window)
        cloud10.draw(window)

    def draw_cloud_3():
        cloud11 = gr.Circle(gr.Point(250, 30), 20)
        cloud11.setFill('white')
        cloud11.setOutline('white')

        cloud12 = gr.Circle(gr.Point(270, 30), 20)
        cloud12.setFill('white')
        cloud12.setOutline('white')

        cloud13 = gr.Circle(gr.Point(235, 50), 20)
        cloud13.setFill('white')
        cloud13.setOutline('white')

        cloud14 = gr.Circle(gr.Point(260, 50), 20)
        cloud14.setFill('white')
        cloud14.setOutline('white')

        cloud15 = gr.Circle(gr.Point(285, 50), 20)
        cloud15.setFill('white')
        cloud15.setOutline('white')

        cloud11.draw(window)
        cloud12.draw(window)
        cloud13.draw(window)
        cloud14.draw(window)
        cloud15.draw(window)
    draw_cloud_1()
    draw_cloud_2()
    draw_cloud_3()
    sea.draw(window)
    sun.draw(window)
    island.draw(window)
    stone.draw(window)
Beispiel #30
0
def EndScreen(scounter):
    #Makes the ground in the background (why it's created first)
    Ground = g.Rectangle(g.Point(0,350), g.Point(1000,700))
    Ground.setFill("ForestGreen")
    Ground.draw(w)
    #main congratulatory message
    message1 = g.Text(g.Point(150,100), "NICE JOB! ")
    message1.setStyle("bold")
    message1.setTextColor("Indigo")
    message1.setSize(36)
    message1.draw(w)
    
    #Makes henrietta and log, copied from title screen (except for the mouth)
    Ear1=g.Oval(g.Point(570,126), g.Point(600,196))
    Ear1.setFill('DarkSlateBlue')
    Ear1.draw(w)
    Ear2=g.Oval(g.Point(831,126), g.Point(863,196))
    Ear2.setFill('DarkSlateBlue')
    Ear2.draw(w)
    
    Body = g.Oval(g.Point(400,350), g.Point(1100,1000))
    Body.setFill('DarkSlateBlue')
    Body.draw(w)
    Head=g.Oval(g.Point(510,145), g.Point(922,465))
    Head.setFill('DarkSlateBlue')
    Head.draw(w)
    
    Face = g.Polygon(g.Point(613,291), g.Point(567,430), g.Point(603,470),g.Point(824,470),g.Point(863,430),g.Point(802,291))
    Face.setFill('plum4')
    Face.draw(w)
    
    Nostril1=g.Oval(g.Point(635,330), g.Point(665,370))
    Nostril1.setFill('DarkSlateBlue')
    Nostril2=g.Oval(g.Point(753,330), g.Point(783,370))
    Nostril2.setFill('DarkSlateBlue')
    Nostril1.draw(w)
    Nostril2.draw(w)
    
    Mouth=g.Circle(g.Point(655,427),25)
    Mouth.setFill('Black')
    Mouth.draw(w)
    
    Eye1=g.Oval(g.Point(653,210), g.Point(690,260))
    Eye1.setFill("black")
    Eye2=g.Oval(g.Point(731,210), g.Point(768,260))
    Eye2.setFill("black")
    Eye3=g.Circle(g.Point(756,229), 5)
    Eye3.setFill("White")
    Eye4=g.Circle(g.Point(680,229), 5)
    Eye4.setFill("White")
    for  obj in [Eye1,Eye2,Eye3,Eye4]:
                obj.draw(w)
                
    
    Log1= g.Rectangle(g.Point(0,564), g.Point(246,700))
    Log2=g.Circle(g.Point(246,632),68)
    Log3=g.Circle(g.Point(246,632),48)
    Log4=g.Circle(g.Point(246,632),28)
    for obj in [Log1,Log2, Log3,Log4]:
                obj.setFill('sienna4')
                obj.setOutline('Black')
                obj.setWidth(4)
                obj.draw(w)
    
    Leaf=g.Oval(g.Point(115,502), g.Point(132,529))
    Leaf.setFill('green')
    Leaf.draw(w)
    Stem=g.Rectangle(g.Point(122,526), g.Point(132,566))
    Stem.setFill('sienna4')
    Stem.draw(w)
    
    #makes quote box and text for henrietta to be saying "phew"
    Textbox=g.Polygon(g.Point(264,347), g.Point(451,347),g.Point(451,380),g.Point(600,425),g.Point(451,410),g.Point(451,420),g.Point(264,420))
    
    Textbox.setFill("White")  
    Textbox.draw(w)
    message3=g.Text(g.Point(355,375), "Phew!") 
    message3.setSize(25)
    message3.draw(w)  
      
    #tells results of the game and instructions to exit
    message5 = g.Text(g.Point(220,250), f"You dodged {scounter} objects")
    message5.setSize(30)
    message5.setFace("courier")
    message5.draw(w)  
    message5 = g.Text(g.Point(694,660), 'Thanks for playing! Press E to exit')
    message5.setSize(30)
    message5.setStyle("bold")
    message5.setTextColor("White")
    message5.draw(w)