diff options
Diffstat (limited to 'test/optionmenu.py')
-rw-r--r-- | test/optionmenu.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/optionmenu.py b/test/optionmenu.py new file mode 100644 index 0000000..47c06d4 --- /dev/null +++ b/test/optionmenu.py @@ -0,0 +1,30 @@ + +from tkinter import * + +ws = Tk() +ws.title('PythonGuides') +ws.geometry('400x300') +ws.config(bg='#F26849') + +def change_width(choice): + choice = variable.get() + dropdown.config(width=choice) + +# width choices available. +width_size = [10, 15, 20, 25, 30] + +# setting variable for Integers +variable = IntVar() + +# creating widget +dropdown = OptionMenu( + ws, + variable, + *width_size, + command=change_width +) +# positioning widget +dropdown.pack(expand=True) + +# infinite loop +ws.mainloop() |