On Thu, 2011-02-03 at 10:32 +1300, Tim Evans wrote:
> On 2011-02-03 10:29, Adam Tauno Williams wrote:
> > I'm happily using PyGtk / Glade-3 and have pretty much recreated an app
> > I've previously made in C# / Gtk#. But I have one frustrating bit. I
> > need to fill a scrolled area with sections of text - but *nothing*
> > appears. Just an empty ScrolledWindow.
> > # task_notation_area is a Viewport in the ScrolledWindo
> > child = self.task_notation_area.get_child()
> > if (child is not None):
> > self.task_notation_area.remove(child)
> > vbox = gtk.VBox()
> > for annotation in self.task['_NOTES']:
> > print 'rendering notation {0}'.format(annotation['objectId'])
> > print annotation['comment']
> > label = gtk.Label()
> > label.set_text(annotation['comment'])
> > vbox.pack_end(label, expand=True, fill=True, padding=2)
> > self.task_notation_area.add(vbox)
> > self.task_notation_area.resize_children()
> > What is the trick for stacking widgets in a scrolled area?
> Looks like you're just missing a "label.show()" call in there.
Correct. It is working well now.
def annotation_to_widget(annotation):
frame = gtk.Frame()
...
return Frame
vbox = gtk.VBox()
notes = sorted(self.task['_NOTES'], key=itemgetter('actionDate'),
reverse=True)
for annotation in notes:
vbox.pack_end(gtk.HSeparator())
vbox.pack_end(annotation_to_widget(annotation), expand=False,
fill=False, padding=2)
vbox.pack_end(gtk.Label(), expand=True, fill=True,
padding=0)
self.task_notation_area.add(vbox)
vbox.show_all()
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/