problems subclassing a PMW widget
Martin Franklin
martin.franklin at westgeo.com
Wed Dec 12 05:30:57 EST 2001
This is what I do to subclass a Pmw widget.....:
class MyScrolledText(Pmw.ScrolledText):
def __init__(self, parent = None, **kw):
# Define the megawidget options.
INITOPT = Pmw.INITOPT
optiondefs = (
('borderframe', 0, INITOPT),
('hscrollmode', 'dynamic', self._hscrollMode),
('labelmargin', 0, INITOPT),
('labelpos', None, INITOPT),
('scrollmargin', 2, INITOPT),
('usehullsize', 0, INITOPT),
('vscrollmode', 'dynamic', self._vscrollMode),
)
self.defineoptions(kw, optiondefs)
Pmw.ScrolledText.__init__(self, parent)
self.initialiseoptions(MyScrolledText)
def write(self, stuff):
self.insert('end',stuff)
self.yview_pickplace('end')
self.update()
So you may need to call defineoptions and initialiseoptions........
HTH
Martin
More information about the Python-list
mailing list