--- Christian Robottom Reis <[EMAIL PROTECTED]> wrote:
> On Sat, Jan 17, 2004 at 04:31:33AM -0800, Sridhar R
> wrote:
> > I think the solution to this problem is libglade
> > should have a function that takes already created
> > widget (window?) as id and sets the properties on
> that
> > widget, then adding the children that widget.
> That
> > widget is commonly a gtk.Window. If libglade has
> such
> > a function them the above example could be written
> as
> > ..
> >
> > class MyWindowGreat(gtk.Window):
> > def __init__(self):
> > super(MyWindow, self).__init__()
> > self.gladexml = glade.XML('my.glade',
> > existing=self)
> > wind =
> self.gladexml.get_widget('main_window')
> > print wind is self # This is prints `True`
>
> How would you specify multiple pre-existing widgets?
No. not multiple, only single. glade.XML() creates
the widgets immediately. My problem is to instruct
not to create (a particular widget say gtk.Window i.e.
toplevel in glade file) the widget immediately. So
that later I can pass my own widget (here gtk.Window
instance, a base class instance) to some func in
libglade so that it assigns properties acc. to glade
file and return completely designed (with children
added) window.
Again I tried this,
class MyWind(gtk.Window):
def __new__(cls, *args, **k):
xml = glade.XML('file.glade')
w = xml.get_widget('toplevel_wind')
return w
def __init__(self):
pass
But the problem here is self (in __init__) is a base
class instance.
Is there any way to convert an base class instance to
derived class instance???
(Note: one cannot set the __class__ attr of instances)
=====
Sridhar R
Email: [EMAIL PROTECTED]
WWW: http://sridhar.has.it
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/