Tkinter button Invoke() Method

Tkinter button widget can be used to perform a specific Task. invoke() method can be called up after the initialization of the Button widget. It is called automatically once the Button widget is Prepared. There is no effect  if the button is disabled or Enabled.

Example 2:


******Your code Below*****

from tkinter import *
from tkinter import messagebox
import time

def button1():
messagebox.showinfo(title='Info', message='You Press Button 1')

def button2():
messagebox.showinfo(title='Info', message='You Press Button 2')
time.sleep(1)
btn_1.invoke()

root = Tk()
root.title("Button Invoke")
root.geometry("800x350+450+86")

btn_1= Button(root, text="Button 1", font=('times', 20, 'bold'), command=button1)
btn_2= Button(root, text="Button 2", font=('times', 20, 'bold'), command=button2)

btn_1.pack(pady=20)
btn_2.pack(pady=30)
root.mainloop()

********End Code**********


Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.





Enjoy..............


If You Want To Learn More Plz Visit www.newpost24.com

If You Find Specific link plz Follow This Page.

Post a Comment

أحدث أقدم