Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_click_me_btn.py
- from Tkinter import *
- from random import *
- def do_event(event):
- print
- print "M: {},{}".format(event.x,event.y)
- def jump(event):
- zx,zy=randint(5,160),randint(5,160)
- print "B: {},{}".format(zx,zy)
- meBtn.place(x=zx,y=zy)
- def caught():
- print "You Caught Me !!!"
- root = Tk()
- frame = Frame(root)
- root.geometry("200x200")
- root.title('CMIYC!')
- root.bind("<Button-1>",do_event)
- lbl=Label(root, text='Click "ME" If You Can!')
- lbl.pack()
- frame.pack()
- meBtn = Button(root,text='"ME"',command=caught)
- meBtn.bind("<Enter>",jump)
- meBtn.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement