[pygtk] AspectFrame shrinking?

omarb at inf.ufrgs.br omarb at inf.ufrgs.br
Wed Nov 29 13:03:49 WST 2006


Hello!

I'm trying to use an AspectFrame to make an application look better,  
and it isn't working as I expected. I'm trying it like this.

vbox = gtk.VBox()
vbox.add(gtk.Label('X'))
vbox.add(gtk.Label('1'))
af = gtk.AspectFrame(obey_child = False)
af.add(vbox)

Well, I have many couple of one-character labels like this, and I want  
them all to look reasonable, and I thought AspectFrame should be the  
perfect solution for that, right? Well, I expected it to expand until  
the default aspect of 1 was achieved, but it's actually SHRINKING to  
achieve this... rendering my labels useless!!

What am I doing wrong?

Full code fragment:

flags = [('N', 0), ('Z', 1), ('C', 0), ('V', 0), ('B', 0)]

# flags
hbox = gtk.HBox()
vbox.add(hbox)
hbox.set_homogeneous(True)
for letra, flag in flags:
	label = gtk.Label(letra)
	label.set_alignment(0, 0.5)
	dado = gtk.Label(str(flag))
	dado.set_alignment(1, 0.5)
	box = gtk.VBox()
	box.add(label)
	box.add(dado)
	moldura = gtk.AspectFrame(obey_child = False)
	moldura.add(box)
	align = gtk.Alignment()
	align.set_property('xalign', 0.5)
	align.set_property('yalign', 0.5)
	align.add(moldura)
	hbox.pack_start(align)

Thanks in advance!!

Omar Balbuena

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the pygtk mailing list