From 8f0751170385989677392f806762a211f99412ef Mon Sep 17 00:00:00 2001 From: Vikas Kushwaha Date: Thu, 21 Nov 2024 13:23:10 +0530 Subject: First Commit --- test/optionmenu.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/optionmenu.py (limited to 'test/optionmenu.py') 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() -- cgit v1.2.3