Quoting Martin Franklin <[EMAIL PROTECTED]>:
> I have attempted to write a (Pmw ish) widget like so...
>
> class MyEntry:
> def __init__(self, text='', command=None):
> self.showit(text=text, command=command)
>
> def showit(self, text, command):
> box = GtkHBox(spacing=10)
> box.set_border_width(10)
> label = GtkLabel(text)
> box.pack_start(label)
> label.show()
> self.entry = GtkEntry()
> self.entry.set_text("")
> box.pack_start(self.entry)
> self.entry.show()
> self.entry.connect("activate", command)
> return box
>
> def get_text():
> return self.entry.get_text()
>
>
> Ok so it doesn't work... (won't pack)
Don't forget box.show(). And instead of "def get_text()", you can use
this code: self.get_text = self.entry.get_text. The power of Python.
> My question is has anyone got any good examples of tha above sort of
> stuff
> the pygtk-0.6.5/examples don't really deal with subclassing and creating
> `mega` widgets etc
How about deriving from GtkH/VBox so you can pack the new megawidget just
like any other widget ?
Another solution I used was to have a megawidget which was made up of
several parts which I could attach to a table (for alignment). To
achieve this, I derived from the table class and then I could
attach() these megawidgets via my new GtkTable.
--
==============================================
Sowatec AG, CH-8330 Pfäffikon (ZH)
Witzbergstr. 7, http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, [EMAIL PROTECTED]
==============================================
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk