Skip to content
Advertisement

Get Value of Combobox, while they are bound

I created two Comboboxes in Tkinter. In the first Box you select the Material, the second box reacts to the selected Value of the first box and changes the available options. Its maybe not the best way coded, but it works.

My Problem is, I want to know which colour is selected.

Because if I print (Box_2.get()) it would be empty.

JavaScript

Advertisement

Answer

Try this:

JavaScript

The problem with your code is that you keep creating new Box_2 widgets. Instead you should just use the .config method to change their values. Also each time the user selects something different from Box_1, it will clear Box_2‘s selection.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement