Tkinter question

Adonis deltapigz at telocity.com
Wed Aug 21 17:16:53 EDT 2002


i have an object and wish to click it and drag it to X position, but the
code works somewhat, but the movement is strange, i have tried to place
update_idletasks() to moveObject, but it did little, i have googled around,
but could not find any working code.

any help is greatly appreciated.

Adonis

-- code --

# code is not kosher, it was just whipped up on the fly

from Tkinter import *

def moveObject(event):
    event.widget.place(x=event.x, y=event.y)

root = Tk()
root.geometry("%dx%d%+d%+d"%(640, 480, 0, 0))
b = Button(root, text="foobar")
b.place(x=1, y=1)
b.bind('<B1-Motion>', moveObject)
root.mainloop()





More information about the Python-list mailing list