Python Forum
[Tkinter] Radio Buttons Working Bassackwards
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Radio Buttons Working Bassackwards
#3
Please provide runnable examples. What you leave out may be what you got wrong.

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
Reply


Messages In This Thread
Radio Buttons Working Bassackwards - by gw1500se - Dec-06-2021, 07:07 PM
RE: Radio Buttons Working Bassackwards - by deanhystad - Dec-06-2021, 08:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Is there a way to determine if a radio button has been selected? TWB 5 5,837 Jan-31-2023, 09:44 AM
Last Post: Vadanane
  tkinter toggle buttons not working Nu2Python 26 7,896 Jan-23-2022, 06:49 PM
Last Post: Nu2Python
  [Tkinter] Grid the radio buttons Joni_Engr 6 5,170 Nov-24-2021, 07:20 PM
Last Post: menator01
  Radio butto to enable/disable combo box in Tkinter cybertooth 5 5,895 Oct-09-2021, 07:30 AM
Last Post: cybertooth
  problem with radio button crook79 3 4,002 Aug-12-2021, 02:30 PM
Last Post: deanhystad
  [Tkinter] I can't get information from a radio button aquerci 2 2,889 May-20-2020, 10:31 AM
Last Post: aquerci
  [Tkinter] Radio button help Muzz 5 3,887 Apr-28-2019, 07:43 AM
Last Post: Muzz

Forum Jump:

User Panel Messages

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