Home > other >  Tkinter Radiobutton Virtual "Click" (event)
Tkinter Radiobutton Virtual "Click" (event)

Time:10-05

I'm crazy searching for doing this for days and days...

I need to simulate a virtual click on a Tkinter RadioButton.

In other words. Just when my application starts I need some virtual click event on a radiobutton to force a code execution. I would need my radiobutton in a second option but like if an user had clicked on it.

I readed some stuff abou virtual events but not in Radiobuttons...

Can anyone help me?

Thank you very much.

CodePudding user response:

Sounds to me like you want the invoke() method - it simulates clicking the button

button = tk.Radiobutton()
button.invoke()

CodePudding user response:

It wouldn't be easy to create a virtual event, but you could just run your function on code startup, and than do something like

button = tk.Radiobutton(text="button", command=<Your Command>)
button.select()
  • Related