Tkinter drag and drop

Adonis deltapigz at telocity.com
Sat Nov 23 16:30:06 EST 2002


i have a frame within a frame i want to "drag" it by a label i am trying
this:
(code is incomplete)

    def _MoveObjectFra(self, event):
        self.fraObjects.place(x=event.x_root, y=event.y_root-24)

    def __init__(self):
        winRoot = Tk()
        winRoot.title("Tkinter Builder (0.1a)")
        winRoot.geometry("%dx%d%+d%+d"%(800, 600, 1, 1))

        fraMain = Canvas(winRoot, bg="SystemAppWorkspace",
                         bd=2, relief=SUNKEN, width=800, height=600)
        fraMain.pack(fill=BOTH, expand=1)

        self.fraObjects = Frame(fraMain, bd=2, relief=RAISED, width=200,
height=400)
        self.fraObjects.place(x=2, y=2)

        lblObjects = Label(self.fraObjects, bd=2, relief=GROOVE,
text="Objects")
        lblObjects.place(x=2, y=2, width=191)

        lblObjects.bind('<B1-Motion>', self._MoveObjectFra)

it moves.. but the movement behavior is not what i want though, i have
googled and found one using the Canvas object, but i would like if all
possible to be done in a frame.

any help is greatly appreciated.

Adonis





More information about the Python-list mailing list