Reputation: 13
I have made a program in Python 3 and Tkinter, which is using radio buttons. Now, how can I make that some of the radio buttons are already checked?
Upvotes: 1
Views: 1078
Reputation: 7906
You want to use the select method on the a radio button like so:
import tkinter as tk
root = tk.Tk()
root.title("Radio Button Example")
button = tk.Radiobutton(root) # Make a radio button
button.pack() # Pack it to the screen
button.select() #This is the bit that makes it checked
root.mainloop()
For some more information about RadioButtons in tk check out this page on tutorials point:
http://www.tutorialspoint.com/python/tk_radiobutton.htm
Upvotes: 1