brandizzi
brandizzi

Reputation: 27090

Filling the action area of a gtk.Dialog window with its buttons - instead of having them aligned to the right

Using PyGTK, I create a bunch of buttons in the action area of a gtk.Dialog using the add_button() method, as below:

self.replace_all_button = self.add_button(_("Replace All"), 
            gtk.RESPONSE_ACCEPT)

The resulting dialog has all the buttons aligned to the right, as seen in the following image:

gtk.Dialog with action buttons aligned to the right

However, I want to fill the action area with the buttons, just like in this image:

enter image description here

I have tried some curious strategies, such as to redefine the packing parameters of all widgets from the action area, as seen in the code below, but it did not work.

def redefine_packing(widget):
    _, _, padding, _ = self.action_area.query_child_packing(widget)
    self.action_area.set_child_packing(widget, True, True, padding, _)

self.action_area.foreach(redefine_packing)

How could I do it? (A solution does not need to be written in Python if I can intuitively translate it from the original language, which I usually can do)

Upvotes: 1

Views: 1183

Answers (2)

brandizzi
brandizzi

Reputation: 27090

My problem was "solved" when I discovered I was looking for a nonexistent problem.

I am trying to copying the look-and-feel fo the Gedit search and replace window. Then I started Gedit using the "C" locale and the search and replace dialog looked like this:

Search and replace dialog with labels in English

So the dialog I am trying to copy is just like the dialog I have. The original dialog I was looking at seemed different just because its labels were in a different language and were bigger.

Upvotes: 0

dumbmatter
dumbmatter

Reputation: 9683

Maybe you could replace the hbuttonbox in the dialog with a normal hbox and then more easily control the packing.

Upvotes: 1

Related Questions