Python Forum
[Tkinter] tkiinter combobox selection problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] tkiinter combobox selection problem
#1
so i am working on converter app so there is two comboboxes so there is meter is default value in combbox1 and kilometer value in combobox 2 and i have used ComboboxSelected event and check the condition if it match the condition then call the function. but problem is that as kilometer is default value. when i put value and press enter it doesn't work because i have not selected kilometer myself. so is there a solution that it will work without selceting default value again from combobox.
Reply
#2
selection = StringVar(root)
selection_values = ['Meter to Foot', 'Foot to Meter']
selection.set(selection_values[0]) # this sets the Combobox to the first element of the list

selection_box = Combobox(root, values=selection_values, textvariable=selection)
# your event detection with Combobox
selection_box.pack()
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
You need to post your code. Without it no-one will be able to help you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] How can I sync Combobox index to other combobox index? nickzsche 2 2,398 Jan-03-2022, 12:29 PM
Last Post: Axel_Erfurt
  [python] [Tkinter] Problem bidding combobox with np.array NEL 3 3,405 Aug-04-2019, 11:07 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020