Python Forum
[Tkinter] tkiinter combobox selection problem - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] tkiinter combobox selection problem (/thread-4183.html)



tkiinter combobox selection problem - Rishav - Jul-28-2017

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.


RE: tkiinter combobox selection problem - DeaD_EyE - Jul-28-2017

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()



RE: tkiinter combobox selection problem - Barrowman - Jul-28-2017

You need to post your code. Without it no-one will be able to help you.