blob: 47c06d4513515d383a38bee0e919695a63078f71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()
|