Sep 4, 2001, 10:56 AM
Post #3 of 3
On 04 Sep 2001 16:50:09 +0100, Ken Guest <firstname.lastname@example.org> wrote:
>I've searched through the Pmw documentation and can't determine
>if it's possible to lock the ComboBox from keyboard input,
>in short I want to stop users from entering text into the ComboBox.
>anybody know how to do this?
It seems to be sufficient to the Entry widget's state to disabled:
>>> from Tkinter import *
>>> import Pmw
Pmw passes configuration options that have underlines in them down to
the component widgets that have the name that's the part before the
underline. Since the combobox's text field is a Pmw.EntryField (called
entryfield) and the EntryField's actual text field is a Tkinter Entry
(called entry), setting entryfield_entry_state to disabled gets the
disabled setting down to the thing that actually needs disabling.
Conveniently, Pmw's EntryField automatically un-disables the entry and
re-disables it when its contents are being changed by the setentry()
method, which is what the ComboBox uses.
As is often the case, Pmw turns out to be somewhat subtle but very