0

I created with Tkinter two Listbox. But the problem is that I would like to have the possibility to select just one item in every Listbox but I can select multiple items in the same Listbox.

Is it possible to select for example in my code Peter and New York at the same time ? Thank you very much !

This is my code :

import Tkinter as tk
from Tkinter import Label, Listbox, END


root = tk.Tk()

field_label1 = Label(root, text = "Select a player : ")
field_label1.pack()

list1 = Listbox(root, selectmode = 'browse')
list1.pack()
list1.insert(END,"Peter")
list1.insert(END,"Bill")

field_label2 = Label(root, text = "Select a team : ")
field_label2.pack()     

list2 = Listbox(root, selectmode = 'browse')
list2.pack()
list2.insert(END,"New York")
list2.insert(END,"San Francisco")

root.mainloop()
nbro
  • 15,395
  • 32
  • 113
  • 196

0 Answers0