views:

56

answers:

1

I'm working on a PyGTK app with some Buttons that, when clicked, give a text entry dialog, then set the text on the button to whatever was entered in the box. The problem is that if the text is longer than the button can show, the button changes size to accomodate. How do I keep GTK Buttons from resizing when the text changes?

A: 

Have you tried set_size_request?

http://library.gnome.org/devel/pygtk/stable/class-gtkwidget.html#method-gtkwidget--set-size-request

button = gtk.Button("text on button")
button.set_size_request(width=30)

Or something like that.

In glade, you can set "Width request" in the "Common" tab.

Antoine Leclair