-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomboboxex.py
More file actions
43 lines (35 loc) · 970 Bytes
/
comboboxex.py
File metadata and controls
43 lines (35 loc) · 970 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
# python program demonstrating
# Combobox widget using tkinter
import tkinter as tk
from tkinter import ttk
# Creating tkinter window
window = tk.Tk()
window.title('Combobox')
window.geometry('500x250')
# label text for title
ttk.Label(window, text = "GFG Combobox Widget",
background = 'green', foreground ="white",
font = ("Times New Roman", 15)).grid(row = 0, column = 1)
# label
ttk.Label(window, text = "Select the Month :",
font = ("Times New Roman", 10)).grid(column = 0,
row = 5, padx = 10, pady = 25)
# Combobox creation
n = tk.StringVar()
monthchoosen = ttk.Combobox(window, width = 27, textvariable = n)
# Adding combobox drop down list
monthchoosen['values'] = (' January',
' February',
' March',
' April',
' May',
' June',
' July',
' August',
' September',
' October',
' November',
' December')
monthchoosen.grid(column = 1, row = 5)
monthchoosen.current()
window.mainloop()