>> | -        vbox.pack_start(self.make_shot_box(), False)
>> | +         vbox.pack_start(self.make_shot_box(), False, False)
>> 
>> Isn't the third parameter to pack_start ignored anyway if the second one
>> is False?
>
> No!  the prototype is :
> def pack_start(child, expand=True, fill=True, padding=0)
> So to set 'fill' to False you need at least 3 arguments.

I don't understand.

http://www.pygtk.org/pygtk2tutorial/sec-DetailsOfBoxes.html:

"The fill argument to the pack methods control whether the extra space
 is allocated to the objects themselves (True), or as extra padding in
 the box around these objects (False). It only has an effect if the
 expand argument is also True".

In the above line you set expand to False, so you don't have to provide
a value for fill, IMO.

>> |      def make_shot_box(self):
>> | -        box = gtk.HBox(True, 10)
>> | +         box = gtk.HBox(False, 10)
>> 
>> 
>> This seems to get rid of the spacing between the label and spin
>> button -- but why?
>
> It doesn't.  It just sets the spacing of the widgets.
> The code "box = gtk.HBox(spacing = 10)" would do the same thing.

The spacing is the same in both versions, you changed the 'homogenous'
parameter.

>> | +         box.pack_start(gtk.Label(''), True, True, 0)
>> 
>> What is this for?
>
> It (and its mate further along) are there to use up the available 
> space in 'box' to make the other widgets as small as possible, and to 
> thereby cause them to be centralized.

Uh, I think I see. So the only way to center something in a box is to
add an "empty" element on both sides with expand=True?

> As another thing, there is an easier way to create the buttons in the 
> make_button_box() function.
>           for (name,number) in [
>                   ('INIT',1),
>                   ('PULSE ON',2),
>                   ('STORE',3),
>                   ('ANALYSIS',4)] :
>              button = gtk.Button(name)
>              button.connect('clicked', self.blub, number)
>              box.pack_start(button, True, True)

The buttons of course call different functions in the real code, this
was just to simplify the example.


Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to