From: Greg M. <gr...@in...> - 2003-02-02 11:57:04
|
Joshua, From the Pmw.MegaArchetype reference manual: If defineoptions() is called, it must be called once in the megawidget constructor before the call to the constructor of the base class and there must be a matching call to initialiseoptions() at the end of the constructor. So, your constructor must look like this: class mylistbox(Pmw.ScrolledListBox): def __init__(self,parent=None,**kw): # Define the megawidget options. self.defineoptions(kw, ()) # Initialise the base class. Pmw.ScrolledListBox.__init__(self,parent) # Check keywords and initialise options. self.initialiseoptions() However, if you do not want to add any new options, then this is sufficient: class mylistbox(Pmw.ScrolledListBox): def __init__(self,parent=None,**kw): # Initialise the base class using the keyword options. apply(Pmw.ScrolledListBox.__init__, (self, parent), kw) Hope this helps. Greg On Fri 31 Jan 2003 at 09:37:17AM -0800, Joshua Gerth wrote: > Hello, > > I've been searching the archives for a while and the Pmw 'known bugs' > page so I hope this is not an old question. > > I am attempting to subclass the Pmw.ScrolledListBox widget as I want to > make a few changes. However, when I create an instance of my subclass it > no longer has its scroll bars. Am I missing something? I am using Python > 2.2.2 and Pmw 1.1 on Linux. If anyone has any suggestions or information > I would be most greatful. At the bottom is my example which demonstrates > this problem. > > Thanks, > Joshua > > ------------------------------------ > #!/usr/bin/env python > > from Tkinter import * > import Pmw > > class mylistbox(Pmw.ScrolledListBox): > def __init__(self,parent=None,**kw): > > self.defineoptions(kw, ()) > Pmw.ScrolledListBox.__init__(self,parent) > > root = Pmw.initialise() > > items = ('dog','cat','pig','horse','cow','donkey','chicken','goat', > 'dog','cat','pig','horse','cow','donkey','chicken','goat') > > Pmw.ScrolledListBox(root, items=items).pack() > > mylistbox(root, items=items).pack() > > root.mainloop() > ------------------------------------ > > ===== > Consumerism is self-expression for the uncreative. > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Pmw-general mailing list > Pmw...@li... > https://lists.sourceforge.net/lists/listinfo/pmw-general > -- Greg McFarlane Really Good Software Pty Ltd Sydney Australia gr...@in... |