invoke(): Calls the button's callback, and returns what that function returns. Has no effect if the button is disabled or there is no callback.


Reference:

How to execute python tkinter button without clicking mouse [closed]

from Tkinter import *
import tkMessageBox

t = Tk()

def button1_click():
    tkMessageBox.showinfo("Message", "Bang!")

def button2_click():
    button1.invoke()

button1 = Button(t, text="Button 1", command=button1_click)
button1.pack()

button2 = Button(t, text="Button 2", command=button2_click)
button2.pack()

mainloop()

results matching ""

    No results matching ""