subclassing from Pmw.ScrolledListBox drops the scroll bar
Abel Daniel
abli at freemail.hu
Tue Feb 11 12:51:30 EST 2003
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 (hrakaroo at 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
abli at freemail.hu
More information about the Python-list
mailing list