Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # fallGreetings.py
- # Robert Niggebrugge
- #
- #
- # I certify that this is my own work
- #
- from graphics import *
- from time import *
- win = GraphWin("Greeting", 350, 500, autoflush=False)
- leaf_1 = Polygon(Point(30,45), Point(32.5,60), Point(35,45))
- leaf_2 = Polygon(Point(30,45), Point(30,40), Point(20,42.5))
- leaf_3 = Polygon(Point(35,45), Point(45,42.5), Point(35,40))
- square_leaf = Rectangle(Point(30,45), Point(35,40))
- stem = Line(Point(32.5,40), Point(32.5, 30))
- square_leaf.setFill("orange")
- leaf_1.setFill("orange")
- leaf_2.setFill("orange")
- leaf_3.setFill("orange")
- leaf_1_C = leaf_1.clone()
- leaf_2_C = leaf_2.clone()
- leaf_3_C = leaf_3.clone()
- square_leaf_C = square_leaf.clone()
- stem_C = stem.clone()
- #NOW TRYING TO LOOP BETWEEN FALLING LEAFS AND PUTTING THEM BACK IN POSITION
- # NEED TO SET THE LEAF AS A GLOBAL VARIABLE SO THAT IT CAN BE REFERENCED IN EITHER CLASS
- # Purpose: to bring up a window for a card that a user can see and click on to go away
- def fallGreetings():
- # this is bringing up the window for the card
- #win = GraphWin("Greeting", 350, 500, autoflush=False)
- # first graphical object
- circle = Circle(Point(175,250), 60)
- circle.draw(win)
- Circle.setFill(circle, "red")
- # Text graphical object
- greet = Text((Point(175,250)), "Happy Fall")
- greet.setSize(10)
- greet.draw(win)
- # down part
- #leaf_1 = Polygon(Point(30,45), Point(32.5,60), Point(35,45))
- leaf_1.draw(win)
- # leaf_1_C = leaf_1.clone()
- # left part
- #leaf_2 = Polygon(Point(30,45), Point(30,40), Point(20,42.5))
- leaf_2.draw(win)
- #leaf_2_C = leaf_2.clone()
- # right part
- #leaf_3 = Polygon(Point(35,45), Point(45,42.5), Point(35,40))
- leaf_3.draw(win)
- #leaf_3_C = leaf_3.clone()
- #square in the middle
- #square_leaf = Rectangle(Point(30,45), Point(35,40))
- square_leaf.draw(win)
- #square_leaf_C = square_leaf.clone()
- #square_leaf.setFill("orange")
- #leaf_1.setFill("orange")
- #leaf_2.setFill("orange")
- #leaf_3.setFill("orange")
- #stem = Line(Point(32.5,40), Point(32.5, 30))
- stem.draw(win)
- #stem_C = stem.clone()
- for i in range(150):
- leaf_3.move(2, 5)
- leaf_2.move(2, 5)
- leaf_1.move(2, 5)
- square_leaf.move(2, 5)
- stem.move(2, 5)
- update(30)
- def moveclone():
- leaf_1_C.draw(win)
- leaf_2_C.draw(win)
- leaf_3_C.draw(win)
- square_leaf_C.draw(win)
- stem_C.draw(win)
- #for closing the window
- ## PROBLEM: CANT FIND A WAY TO CONTINUOUSLY LOOP BETWEEN greetings and moveclone
- ##
- def main():
- switch == True
- while switch == True:
- fallGreetings()
- switch = False
- while switch == False:
- moveclone()
- switch == True
- win.getMouse()
- main()
Add Comment
Please, Sign In to add comment