> 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? > Could not agree more.
> 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. > Absolutely, you cannot add a textview in GLADE for each record in your database, while it might work in a contrived example, it won't work in the real world where the number of records will change from day to day. > 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. > Personally I don't think the textview is the best widget for presenting the data in your database. A textview for each row on the database sounds an expensive way to go. I think it would be better presented in a single TreeView (with a ListStore model behind it). You can present only the columns of the database you want presented. You had a requirement to be able to edit a record you saw some errors in, this functionality could be supported in a treeview/liststore, if you wanted you could pop up another dialog to edit that specific record if you wanted. >> All the links I've found don't use glade. As always, any help is >> appreciated. While it's a bit old and covers libglade rather than gtkbuilder the principles a still the same, You need to modify the code a bit removing the 'old' libglade way of getting at and using your glade objects and add code to use the 'new' gtkbuilder way to get access to the same GUI objects. You will also have to add code to keep your liststore and database in sync with each other. (remember it's written back in 2006 so it's probably using an older version of Glade than you are now.) http://www.pygtk.org/articles/application-pygtk-glade/Building_an_Application_with_PyGTK_and_Glade.htm some more a quick google search turned up (watch out for libglade references) http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html http://www.overclock.net/application-programming/342279-tutorial-using-python-glade-create-simple.html http://www.linuxjournal.com/article/6586?page=0,0 Steve _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
