Search code examples
gtkpygtkdragseparatorpane

Pygtk: Disable moving separator in a gtk.Paned (HPaned/VPaned)


Is there a way I can stop the user from dragging around the separator in a gtk.Paned? I don't want to disable it completely... if any child resized or set_position() was called, the separator should still change position.

Thanks!


Solution

  • One possible (dirty :)) way would be to track Paned' events and re-set its size:

    def handle_cb (pane, param):
        # detect if paned is locked
        # or its position has changed - ommited
        pane.set_position(10)
        return True
    
    pane = gtk.VPaned()
    ...
    pane.connect("notify", handle_cb)
    

    I'd try to set child widgets unshrinkable first, though.