Tkinter: select multiple entries in Listbox widget?

SuperHik junkytownMAKNI at gmail.com
Fri Jun 2 08:56:54 EDT 2006


Rob Williscroft wrote:
> Bernard Lebel wrote in news:mailman.6413.1149178158.27775.python-
> list at python.org in comp.lang.python:
> 
>> Hello,
>>
>> Is there an option or a way to allow the selection of multiple entries
>> in the Listbox widget? I could not find any, and would like to allow
>> the end user to select multiple entries.
>>
>>
> 
> When configuring use:
> 
>   selectmode = "multiple"
> 
> e.g.:
> 
> import Tkinter as tk
> 
> root = tk.Tk()
> 
> a = tk.Listbox( root, selectmode = "multiple" )
> for i in range(10):
>   a.insert( i, str(i) + " item" )
> 
> a.pack()
> root.mainloop()
> 
> I found the answer here:
> 
> http://www.python.org/doc/life-preserver/ClassListbox.html
> 
> Though I had to guess the `= "multiple"` part.
> 
> Rob.
cool.
never needed it so far but it's nice to know :D



More information about the Python-list mailing list