Answers for "tkinter optionmenu"

3

dropdown in tkinter

from Tkinter import *

master = Tk()

variable = StringVar(master)
variable.set("one") # default value

w = OptionMenu(master, variable, "one", "two", "three")
w.pack()

mainloop()
Posted by: Guest on November-06-2020
2

python optionmenu tkinter

from tkinter import Tk, StringVar, OptionMenu, mainloop
parent = Tk()
varList = StringVar(parent)
varList.set("Red")
om = OptionMenu(parent, varList, "Yellow", "Pink", "RED", "Brown", "Black", "Blue")
om.pack()
parent.mainloop()
Posted by: Guest on March-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language