Pmw.ComboBox label_text param causes error

Martin Franklin martin.franklin at westerngeco.com
Thu Mar 21 17:54:33 EST 2002


Tom Good wrote:

> The Pmw ComboBox sample code at:
> 
> http://pmw.sourceforge.net/doc/ComboBox.html
> 
> shows label_text as one of the possible keyword arguments to the
> constructor.  However, when I use it I get the error shown below.  I'd
> appreciate assistance in figuring out the problem.
> 
> 
> PythonWin 2.1.1 (#20, Jul 26 2001, 11:38:51) [MSC 32 bit (Intel)] on
> win32.
> Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) -
> see 'Help/About PythonWin' for further copyright information.
>>>> from Tkinter import *
>>>> import Pmw
>>>> Pmw.version()
> '0.8.5'
>>>> combo = Pmw.ComboBox(None, label_text="foo")
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
>   File "C:\Python21\lib\Pmw\Pmw_0_8_5\lib\PmwComboBox.py", line 139,
> in __init__
>     self.initialiseoptions(ComboBox)
>   File "C:\Python21\lib\Pmw\Pmw_0_8_5\lib\PmwBase.py", line 557, in
> initialiseoptions
>     raise KeyError, text + string.join(unusedOptions, ', ') + \
> KeyError: Unknown option "label_text" for ComboBox
>>>>
Tom,


For some reason the COmboBox (and possibly other Pmw's) require the labelpos
option if you want label_text (the default for labelpos is no label text so 
I supose this is by design.....  anyhow this works:-

import Pmw
combo = Pmw.ComboBox(None, labelpos='w', label_text="foo")

Martin










More information about the Python-list mailing list