Python Forum
[Tkinter] Registering user's drop down menu choice and finding corresponding line in files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Registering user's drop down menu choice and finding corresponding line in files
#2
Bind a function to the command option of tk.OptionMenu

import tkinter as tk


def selected(value):
    print(value)


win = tk.Tk()
win.geometry("450x600+300+300")
# win.overrideredirect(1)

title = tk.Label(
    win, text="Please choose which member's info you would like to view.")
title.pack(fill=tk.X, padx=10)
names = ['one', 'two', 'three']
var = tk.StringVar()
var.set('Click to Select Member')
memberlist = tk.OptionMenu(win, var, *names, command=selected)
memberlist.pack(fill=tk.X, padx=10)

win.mainloop()
Reply


Messages In This Thread
RE: Registering user's drop down menu choice and finding corresponding line in files - by Yoriz - Oct-01-2019, 07:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGUI] [Solved]Help storing in user input from line edit Extra 2 1,681 May-12-2022, 07:46 PM
Last Post: Extra
  PyQt5: How do you set the user input of a line edit to a specific variable? YoshikageKira 17 11,477 Dec-26-2019, 03:18 PM
Last Post: Denni
  Choice of GUI implementation jefsummers 2 2,074 May-19-2019, 11:15 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020