Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

subclassing from Pmw.ScrolledListBox drops the scroll bar

0 views
Skip to first unread message

Joshua Gerth

unread,
Jan 30, 2003, 5:53:55 PM1/30/03
to
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. 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()
------------------------------------

Abel Daniel

unread,
Feb 11, 2003, 12:51:30 PM2/11/03
to
This might be a bit dated, but I hit the same problem, and I think at
least the archives (and groups.google.com) should have the solution in
case somebody needs it later.

Joshua Gerth (hrak...@yahoo.com) 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. 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)

self.initialiseoptions(mylistbox)


>
> 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()

You left that out. From the docs (emphasis mine):

initialiseoptions(myClass)
Check keyword arguments and call option callback functions. This
must be called at the end of a megawidget constructor with myClass
^^^^
set to the class being defined.

abli
ab...@freemail.hu

0 new messages