简体   繁体   中英

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.

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM