Any suggestions on how one might create event bindings that would allow a user to mouse drag a window without borders, eg. a window created with overridedirect(1)
?
Use case: We would like to create a floating toolbar/palette window (without borders) that our users can drag around on their desktop.
Here's where I'm at in my thinking (pseudo code):
window.bind( '<Button-1>', onMouseDown )
to capture the initial position of the mouse.window.bind( '<Motion-1>', onMouseMove )
to track position of mouse once it starts to move.Calculate how much mouse has moved and calculate
newX
,newY
positions.Use
window.geometry( '+%d+%d' % ( newX, newY ) )
to move window.
Does Tkinter expose enough functionality to allow me to implement the task at hand? Or are there easier/higher-level ways to achieve what I want to do?