[pygtk] Sometimes VBox, sometimes HBox
David López Luengo
olelen at gmail.com
Mon Jan 25 20:50:44 WST 2010
Hi everybody there,
Well, the question i'm going to ask could be done in help en python.org too,
but since i got it from using pygtk i will first ask it here to use names
accordingly to pygtk and gtk in general. Other point, i'm not english so i
apologize for the (for sure) mistakes. Lets go.
I'm developing a class that needs sometimes to show what it contains in a
vertical paradigm an other times in an horizontal one. For this purpose i'm
using (or i want to use) gtk.VBoxes and gtk.HBoxes. When i initializes an
instance of this new own class i have a parameter just to discriminate what
kind of box i need. This own class inherits both from gtk.VBox and gtk.HBox
but, here comes the problem, when methods (inherited from Boxes) are called
the result is always from the first class inherited. For example:
...
HORIZONTAL = 1
VERTICAL = 2
class MyNewBox(gtk.HBox, gtk.VBox)
def __init__(self, kind_of_box):
if kind_of_box == HORIZONTAL:
gtk.HBox.__init__(self)
elif kind_of_box == VERTICAL:
gtk.VBox.__init__(self)
else:
# probably raise an exception
...
With this scheme everything will work properly but always (even if i
initialize as VBox) i will get children in MyNewBoxes instances represented
horizontally since python defines multiple inheritance as depth-first, *
left-to-right* resolved.
Have you got an idea of how can i get horizontally or vertically
representation whenever it is necessary?
Thanks a lot :)
--
David
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100125/b3ac1581/attachment.htm
More information about the pygtk
mailing list