TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.77k stars 1.03k forks source link

Is it possible to create filled radio button? #2456

Open teijiIshida opened 1 month ago

teijiIshida commented 1 month ago

I'm trying to create radio buttons that have filled center. The current CTkRadioButton have transparent center. I tried changing the fg_color (but it changed the border color???), border_color (doesn't help), border_width_checked (almost replicated but still has a tiny bit transparent in the center but now it no longer have a proper border). Top image is what I'm trying to create (not my GUI). Bottom image is my current radio buttons. Is it possible to create filled radio button?

2024-06-04 12_11_08-ConfigTools v0 3 03 20a 2024-06-04 12_11_16-JVP Batch Files Config Tool v0 1

        self.radio_var1 = ctk.StringVar(value="png")
        self.radiobutton_1 = ctk.CTkRadioButton(self.main_settings_Cframe, text="PNG", font=self.main_font, command=self.radiobutton_event, variable=self.radio_var1, value="png")
        self.radiobutton_1.grid(row=3, column=0, padx=0, pady=1, sticky="nw")                                             
        self.radiobutton_2 = ctk.CTkRadioButton(self.main_settings_Cframe, text="JPG", font=self.main_font, command=self.radiobutton_event, variable=self.radio_var1, value="jpg")
        self.radiobutton_2.grid(row=3, column=0, padx=70, pady=1, sticky="nw")
dipeshSam commented 4 weeks ago

It is the standard appearance of a Radio Button 🔘 (Historically) that there should be a container (either circular or rectangular) around the point regardless of selection.

Still if your GUI requires point type button acting like a radio button, you can utilise Canvas's circle. Assign a tag to it, bind an event, and that's it.

customtkinter provides a method create_aa_circle() to draw quality Anti-Aliased shape of circle.

Regards.

teijiIshida commented 4 weeks ago

Ok, I understand the Canvas solution.

Edit: Thank you. I found an example using it on Google/Youtube.

teijiIshida commented 4 weeks ago

I'm trying to find the documentation for CTkCanvas here, but I don't see it. Where can I read its documentation?

dipeshSam commented 4 weeks ago

The Excessive Tkinter documention can be fount at: https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/