Dec-06-2021, 08:40 PM
Please provide runnable examples. What you leave out may be what you got wrong.
I rewrote you code as this:
When I run this code it appears to
I rewrote you code as this:
import tkinter as tk phone_numbers = ('123-456-7932', '123-456-6305', '123-456-7477') root = tk.Tk() phone_var = tk.StringVar(root, phone_numbers[0]) for phone in phone_numbers: tk.Radiobutton(root, text=phone, variable=phone_var, value=phone).pack() phone_entry = tk.StringVar(root, '') entry = tk.Entry(root, textvariable=phone_entry) entry.pack() entry.bind('<Return>', lambda x: phone_var.set(phone_entry.get())) root.mainloop()I added an entry so I can type in phone numbers and see if they phone_var is working as I expect.
When I run this code it appears to