Combobox in Tkinter

Greg McFarlane gregm at iname.com
Thu Apr 20 10:58:45 EDT 2000


On 16 Apr, johngrayson at home.com wrote:
> In article <38F8F133.54FCC64B at swt.edu>,
>   "Shah, Navneet" <ns566645 at swt.edu> wrote:
> > How to decrease the width of the combobox in Tkinter? Do we have any
> > option for that
> 
> set the width of the entryfield component:
> 
> assuming the combobox id is 'xxx':
> 
>    xxx.component('entryfield').configure(width=4)

This is not quite correct.  The Pmw.ComboBox has an Pmw.EntryField
component, named 'entryfield', which has a Tkinter.Entry component,
named 'entry'. So, more correctly:
   xxx.component('entryfield').component('entry').configure(width = 4)

Since this is long winded, you can use Pmw's component options:
   xxx.configure(entryfield_entry_width = 4)

Or even shorter, since the Tkinter.Entry sub-sub-component of the
Pmw.ComboBox has an alias named 'entry':
   xxx.configure(entry_width = 4)

Component options (and aliases) can also be used during construction:
   xxx = Pmw.ComboBox(entry_width = 4)

For more detail, see the Pmw documentation.

-- 
Greg McFarlane     INMS Telstra Australia     gregm at iname.com




More information about the Python-list mailing list