
import tkinter as tk
my_w = tk.Tk()
my_w.geometry("400x200") # width and height of the window
font1=('Times',22,'normal') # declaring font Family, size and style
def my_upd():
if b2['text']=='Click Me to Agree': # check the text of 2nd button
b2.flash() # flashing the button
else:
b2['text']='Click Me to Agree' # change the text on the button
b1=tk.Button(my_w,text='Submit',font=font1,bd=6,command=my_upd)
b1.grid(row=0,column=1,padx=10,pady=60)
b2=tk.Button(my_w,text='Click Me to Agree',font=font1,bd=6,width=14,
command=lambda:b2.config(text='I agree'),
activebackground='red',activeforeground='yellow')
b2.grid(row=0,column=2,padx=5,pady=60)
my_w.mainloop()
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.