Advertisement
here2share

# tk_optionmenu2.py

Dec 24th, 2020
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. # tk_optionmenu2.py
  2.  
  3. import tkinter as tk
  4. import tkinter.ttk as ttk
  5.  
  6. root = tk.Tk()
  7. root.geometry("160x120")
  8. root.title("Tk OptionMenu")
  9. lst = ["Value A", "Value B", "Value C"]
  10.  
  11. # ttk.OptionMenu
  12. var_option_ttk = tk.StringVar()
  13. optionmenu_ttk = ttk.OptionMenu(
  14.     root,
  15.     var_option_ttk,
  16.     lst[0],
  17.     *lst)
  18. optionmenu_ttk.pack(side=tk.LEFT, padx=10, pady=10, anchor=tk.N)
  19.  
  20. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement