Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I prevent the handle of a GtkPaned from being moved? For instance, I want to lock it according to the status of a GtkToggleButton.

share|improve this question

Assuming the the True state of the GtkToggleButton locks the handle of the GtkPaned, this behavior can be achieved by:

  1. connecting the GtkPaned to the button-press event
  2. returning with the GtkToggleButton state from the handler

Here is a minimalistic example in python using pygtk

import gtk

def on_paned_button_press_event(*args):
    return toggle.get_active() # This is step 2.

win = gtk.Window()
win.set_title('Lock/Unlock the GtkPaned handle example')
win.set_size_request(400, 100)

paned = gtk.HPaned()
toggle = gtk.ToggleButton('Toggle me')
toggle.set_size_request(100, -1)
paned.add2(gtk.Label('Toggle the button on the left to lock/unlock the handle'))

paned.connect('button-press-event', on_paned_button_press_event) # This is step 1.


win.connect('destroy', gtk.main_quit)



It might still be possible to move the handle with the keyboard, so you'd want to connect to the move-handle signal as well for a complete lock.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.