Results 1 to 6 of 6
How would you make a window drag'n'drop? I have hidden the titlebar using:
Code:
self.window.set_decorated(False)
But I still want this window to be moveable, by clicking and dragging anywhere within ...
- 07-24-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 6
Drag'n'Droping Windows in pyGTK
How would you make a window drag'n'drop? I have hidden the titlebar using:
But I still want this window to be moveable, by clicking and dragging anywhere within the window.Code:self.window.set_decorated(False)
I would rather just use pyGTK, but Xlib is fine with me aswell.
thx in advance,
tcb
- 07-25-2010 #2
- 07-27-2010 #3Just Joined!
- Join Date
- Apr 2010
- Posts
- 6
This isn't working, and even if it was it would have only been resizable.
You see, i want there to be no decoration from the WM, so i've hidden its decoration. But it has also got to be moveable. Its not that I don't want to resize, I want it to be movable by Drag'n'Drop anywhere in the window
- 07-27-2010 #4
sorry,
I have not understood
what you want I think is this:
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
from gtk import gdk
class Base:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_decorated(False)
self.window.add_events ( gdk.BUTTON_PRESS_MASK )
self.window.connect ('button-press-event', self.clicked)
self.window.show()
def clicked(self, widget, event):
self.window.begin_move_drag(event.button, int(event.x_root), int(event.y_root), event.time)
def main(self):
gtk.main()
if __name__ == "__main__":
base = Base()
base.main()
- 07-28-2010 #5Just Joined!
- Join Date
- Apr 2010
- Posts
- 6
Looks good... will try it when I get onto my ubuntu PC
- 07-28-2010 #6Just Joined!
- Join Date
- Apr 2010
- Posts
- 6
this script detects mousedown anywhere within the window? This fixes another problem of mine.
Worked like a charm...


Reply With Quote