Aug-25-2023, 06:02 AM
(This post was last modified: Aug-25-2023, 06:37 AM by Gribouillis.)
Hi Everyone,
I have setup a combo box to store gradient values as such:
I am trying to retrieve that selected value when I select it in my gui using the drop down box using:
I have binded as such:
which is tacked on the end of my combo creating code:
however when i select different options in my gui for gradient, it prints empty ''
can someone please help me how to store the value so i can reference as I am trying in the stored_value variable?
I have setup a combo box to store gradient values as such:
1 2 3 |
gradient_value = [ "0%" , "10%" , "15%" , "20%" ] gradient_dropdown = ttk.Combobox(column_frame, values = gradient_value, state = "readonly" ) gradient_dropdown.pack(pady = 5 ) |
1 2 3 4 5 6 |
stored_value = None def store_selected_value(event = None ): grad_sel = gradient_dropdown.get() global stored_value stored_value = grad_sel print ( f "Gradient: '{stored_value}'" ) |
1 |
gradient_dropdown.bind( "<<ComboboxSelected>>" , store_selected_value) |
1 2 3 4 |
gradient_value = [ "0%" , "10%" , "15%" , "20%" ] gradient_dropdown = ttk.Combobox(column_frame, values = gradient_value, state = "readonly" ) gradient_dropdown.pack(pady = 5 ) gradient_dropdown.bind( "<<ComboboxSelected>>" , store_selected_value) |
can someone please help me how to store the value so i can reference as I am trying in the stored_value variable?
Gribouillis write Aug-25-2023, 06:37 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.