I have the following code which sets up some button and radio buttons. The radio buttons (Full Tcl version info: 8.6.11) can not be clicked on my side (Python 3.9.2 on Debian Linux 11):
import tkinter as tkfrom tkinter import ttkclass ComplexGUIExample(tk.Tk): def __init__(self): super().__init__() self.title("Complex GUI Example") self.geometry("400x300") # Frame for VPN controls vpn_frame = tk.Frame(self) vpn_frame.pack(pady=(10, 0), padx=(10, 0), fill=tk.X) # VPN Connection Button button_connect_vpn = tk.Button(vpn_frame, text="Connect VPN", command=self.dummy_command) button_connect_vpn.pack(side=tk.LEFT, padx=(10, 10)) # Check VPN Status Button button_check_vpn = tk.Button(vpn_frame, text="Check VPN Status", command=self.dummy_command) button_check_vpn.pack(side=tk.LEFT, padx=(10, 10)) # Frame for URL Loading Preferences (Radio Buttons) url_pref_frame = tk.LabelFrame(self, text="URL Loading Preferences", padx=10, pady=10) url_pref_frame.pack(pady=(20, 0), padx=(10, 0), fill=tk.X) # Variable to track the radio button selection self.url_loading_preference = tk.StringVar(value="Most Recent") # Radio Buttons for URL Loading Preference tk.Radiobutton(url_pref_frame, text="Most Recent", variable=self.url_loading_preference, value="Most Recent", command=self.on_radio_change).pack(anchor=tk.W) tk.Radiobutton(url_pref_frame, text="Oldest", variable=self.url_loading_preference, value="Oldest", command=self.on_radio_change).pack(anchor=tk.W) tk.Radiobutton(url_pref_frame, text="Random page", variable=self.url_loading_preference, value="Random page", command=self.on_radio_change).pack(anchor=tk.W) def dummy_command(self): print("Button clicked") def on_radio_change(self): print(f"Selected URL Loading Preference: {self.url_loading_preference.get()}")if __name__ == "__main__": app = ComplexGUIExample() app.mainloop()
Image may be NSFW.
Clik here to view.
How do I make the radio buttons clickable ?
I have tried using some other widgets but so far I haven't been able to make it work.