[pygtk] How to add extra Vbox fields

Pietro Battiston toobaz at email.it
Sun Jun 20 18:10:01 WST 2010


Il giorno dom, 20/06/2010 alle 11.21 +0200, Timo ha scritto:
> On 20-06-10 04:06, Lang Hurst wrote:
> > I got this to work using what I think is an ugly hack, but may be how it
> > is supposed to be done.  I created a whole bunch of textviews in glade,
> > and defaulted them to 'not visible'.  Then, as I loop through my
> > results, I put in my information and then make the widget visible.  It
> > works, just doesn't seem right.  Oh well, back to it.
> >    
> That doesn't sound good to me. what if you have more records to show 
> than textviews?
> 
> You will find that in some programs it's just impossible to only use 
> Glade for your GUI, so it is advised to learn some plain PyGTK aswell. 
> In your example, this is the case too.
> 
> The best way (I think atleast) is to manually create your textview and 
> append it to your VBox with vbox.pack_start(textview)
> Maybe even subclass gtk.Textview to have more control.
> This way you will not have to create numerous textviews or add a VBox 
> with lot's of rows in Glade.


Just for completness, another way is to create a gtk.Builder for each
textview. But in this case, it would be much better to isolate the
textview in a separate glade file. Evidently, if the textview has no
particular properties set (doesn't take much code to create one withoug
glade), it's not the optimal solution

Pietro



More information about the pygtk mailing list