Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.6
- def main():
- from Tkinter import Tk, Canvas, BOTH
- root = Tk()
- canvas = Canvas(master=root, background='white')
- canvas.pack(fill=BOTH, expand=1)
- root.geometry("300x200")
- root.resizable(0, 0)
- oval = canvas.create_oval(30, 80, 40, 90, outline='black', fill='red')
- x = 1
- y = 1
- xpos = 35
- ypos = 85
- while True:
- canvas.move(oval, x, y)
- xpos += x
- ypos += y
- if not (295 > xpos > 5):
- x *= -1
- if not (195 > ypos > 5):
- y *= -1
- root.after(10)
- root.update()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement