Created
March 31, 2024 21:51
-
-
Save vigilantPotato/1304d69b973dec7fa0187d4147b8a03e to your computer and use it in GitHub Desktop.
How to use combobox-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
import tkinter | |
from tkinter import ttk | |
if __name__ == "__main__": | |
ctypes.windll.shcore.SetProcessDpiAwareness(1) | |
root = tkinter.Tk() | |
var = tkinter.StringVar(root) #variable | |
#label | |
l = tkinter.Label( | |
root, | |
bg = "cyan", | |
width = 15, | |
textvariable = var, | |
) | |
l.pack() | |
#combobox | |
item_list = ["Easy", "Normal", "Hard"] | |
combobox = ttk.Combobox( | |
root, | |
values = item_list, #set item_list | |
textvariable = var, | |
) | |
combobox.pack() | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment