diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:23:10 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2024-11-21 13:23:10 +0530 |
commit | 8f0751170385989677392f806762a211f99412ef (patch) | |
tree | f09ad917798fa313edb77925a1ddbc6de8fb37ce /test/optionmenu.py |
First Commit
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() |