Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_spacebar_event.py
- from Tkinter import *
- from random import *
- root=Tk()
- canvas=Canvas(root,width=400,height=300,bg='white')
- def draw(event=None):
- canvas.delete(ALL)# clear canvas first
- canvas.create_oval(randint(1,180),randint(1,120),randint(210,399),randint(180,299),fill='red')
- draw()
- canvas.pack()
- root.bind("<space>", draw)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement