nastiliano
nastiliano

Reputation: 53

Tkinter Radiobutton Virtual "Click" (event)

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.

Upvotes: 1

Views: 647

Answers (2)

JRiggles
JRiggles

Reputation: 6790

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

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

Upvotes: 2

KaliMachine
KaliMachine

Reputation: 301

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

Upvotes: 1

Related Questions