Pmw subclassing problem
Matthew Dixon Cowles
matt at mondoinfo.com
Sun Jul 1 13:45:10 EDT 2001
On Sun, 1 Jul 2001 17:25:34 +0100, Robin Becker
<robin at jessikat.fsnet.co.uk> wrote:
>I'm sure the cause of this must be obvious, I want to specialise a
>scrolled text. The existing one shows all the right behaviours, but
>when I recode to use the trivial subclass
>
>class RL_ScrolledText(Pmw.ScrolledText):
> def __init__(self,*args,**kw):
> apply(Pmw.ScrolledText.__init__,(self,)+args,kw)
>
>and change the client code to match
>
>ie change Pmw. to RL_
>
>self.log = RL_ScrolledText(mainlog.pane('log'), labelpos = 'n', \
> label_text = 'Log')
>
>I seem to lose the automatic scroll bars etc, what am I doing wrong?
>Am I missing some class bindins somewhere?
Robin,
I think you're missing one line of Pmw magic. This code seems to work:
class RL_ScrolledText(Pmw.ScrolledText):
def __init__(self,*args,**kw):
apply(Pmw.ScrolledText.__init__,(self,)+args,kw)
self.initialiseoptions(RL_ScrolledText)
There's more about subclassing Pmw widgets at:
http://pmw.sourceforge.net/doc/howtobuild.html
Regards,
Matt
More information about the Python-list
mailing list