Python_program 7

 Practical Name: Write a python GUI program to create two buttons exist and hello using Tkinter module.

_______________________________________________________________

Program :


import tkinter as tk  

def write_text():

    print("Tkinter is easy to create GUI!")

parent = tk.Tk()

frame = tk.Frame(parent)

frame.pack()

text_disp= tk.Button(frame, text="Hello",fg=”green”)                 

text_disp.pack(side=tk.LEFT)

exit_button = tk.Button(frame, text="Exit", fg="green")

exit_button.pack(side=tk.RIGHT)

parent.mainloop()

 

output:-



Post a Comment

Previous Post Next Post