Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tk_optionmenu2.py
- import tkinter as tk
- import tkinter.ttk as ttk
- root = tk.Tk()
- root.geometry("160x120")
- root.title("Tk OptionMenu")
- lst = ["Value A", "Value B", "Value C"]
- # ttk.OptionMenu
- var_option_ttk = tk.StringVar()
- optionmenu_ttk = ttk.OptionMenu(
- root,
- var_option_ttk,
- lst[0],
- *lst)
- optionmenu_ttk.pack(side=tk.LEFT, padx=10, pady=10, anchor=tk.N)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement