[pygtk] VPaned move events
Brad Schick
schickb at gmail.com
Sat Aug 4 04:37:46 WST 2007
What is the best way to detect moving the gutter in a gtk.HPaned or
gtk.VPaned widget? I would have thought it was the "move-handle" signal,
but that only seems to be emitted for keyboard activity. Dragging the
gutter with the mouse does not emit that single. And although hitting
the arrow or page keys on the keyboard does emit the "move-handle"
single, the handle doesn't actually move.
I considered resize signals from the child widgets, but I'd get those
from resizing the entire window as well. Maybe some drag and drop event?
But that would miss keyboard resizing (assume there is a way to actually
resize panes with the keyboard). Below is an example of "move-handle"
doing nothing while resizing with the mouse. Just run it and drag the
gutter.
Thanks for any ideas,
-Brad
----------------------
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
from sys import stdout
def vpaned_moved(paned, scrolltype):
print paned.get_position(), scrolltype
return True
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_default_size(200, 200)
window.connect("destroy", gtk.main_quit)
vpaned = gtk.VPaned()
vpaned.add1(gtk.Button("one"))
vpaned.add2(gtk.Button("two"))
vpaned.connect("move-handle", vpaned_moved)
window.add(vpaned)
window.show_all()
gtk.main()
More information about the pygtk
mailing list