[pygtk] Create hbox control from code

cristian abarzúa abarzuaf at gmail.com
Tue Mar 20 05:01:43 WST 2012


Hi Petr!

What I do is the following:

Create a button that when pressed me a dialog box appears asking me how 
many spaces I want for my control horizontal hbox.

Then the control hbox is created within the window, I indicated at the 
edges, in which I can place a control space (This is the same as does 
the Glade program that shows you the edges of the control space hbox).

A general idea would be:

import gtk

class App:

     def __init__(self):

         self.window = gtk.Window()

         self.hbox = gtk.HBox()

         self.f1 = gtk.Frame()
         self.f2 = gtk.Frame()
         self.f3 = gtk.Frame()

gla
         self.f1.set_border_width(2)
         self.f2.set_border_width(2)
         self.f3.set_border_width(2)

         self.f1.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535))
         self.f2.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535))
         self.f3.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(65535))

         self.hbox.pack_start(self.f1,True)
         self.hbox.pack_start(self.f2, True)
         self.hbox.pack_start(self.f3, True)

         self.window.add(self.hbox)

         self.window.show_all()
App()
gtk.main()


But without the need for controls Frame

Any idea?

Regards

Cristian

El 19/03/12 17:42, Petr Kubánek escribió:
> Hi,
>
> if you mean "to specify how many objects to put into hbox", you just add
> (using pack_start/pack_end methods) objects you want, this is how you
> specify how many fields will hbox hold.
>
> If you mean spacing between objects, there are HBox methods for that
> (set_spacing method or spacing parameter for HBox constructor).
>
> Hope this helps.
>
> Petr
>
> cristian abarzúa píše v Po 19. 03. 2012 v 17:22 -0300:
>> Hi.
>>
>> I need to create a control hbox from code, giving the number of
>> horizontal spaces to create, (the way it does glade), but can not find how.
>>
>> Any suggestions are welcome.
>>
>> Regards
>>
>> Cristian
>> _______________________________________________
>> pygtk mailing list   pygtk at daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://faq.pygtk.org/
>
>



More information about the pygtk mailing list