CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

Is it possible to create filled radio button?

Open teijiIshida opened this issue 1 year ago • 4 comments

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")

teijiIshida avatar Jun 04 '24 17:06 teijiIshida

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.

dipeshSam avatar Jun 05 '24 03:06 dipeshSam

Ok, I understand the Canvas solution.

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

teijiIshida avatar Jun 05 '24 12:06 teijiIshida

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

teijiIshida avatar Jun 05 '24 16:06 teijiIshida

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

dipeshSam avatar Jun 05 '24 17:06 dipeshSam