CODE
from tkinter import *
from tkinter import messagebox
#class WidgetDemo
class WidgetDemo():
#__init__ method
def __init__(self):
#creating window
window = Tk()
#title for window
window.title("Widgets Demo!")
#creating frame in window
frame1 = Frame(window)
frame1.pack()
#creating button with call to processButton() method
button1 = Button(text = "Click Here", command = self.processButton)
button1.pack()
#mainloop
window.mainloop()
#processButton() method to display "Welcome" using messagebox
def processButton(self):
#displaying "Welcome" using messagebox
messagebox.showinfo("Demo!", "Welcome")
CODE SCREEN SHOT
CODE WITH IMPLEMENTING class WidgetDemo
from tkinter import *
from tkinter import messagebox
#class WidgetDemo
class WidgetDemo():
#__init__ method
def __init__(self):
#creating window
window = Tk()
#title for window
window.title("Widgets Demo!")
#creating frame in window
frame1 = Frame(window)
frame1.pack()
#creating button with call to processButton() method
button1 = Button(text = "Click Here", command = self.processButton)
button1.pack()
#mainloop
window.mainloop()
#processButton() method to display "Welcome" using messagebox
def processButton(self):
#displaying "Welcome" using messagebox
messagebox.showinfo("Demo!", "Welcome")
#creating object for WidgetDemo
ob = WidgetDemo()
OUTPUT
CODE SCREEN SHOT
du Scholarshi... Ag Day Essay Cont... (22) Hig bb Question 30 10 [28] Finish the following...
[28] Finish the following code in such a way that there will be a button displayed in the GUI. When th button is clicked a message box will display "Welcome" from tkinter import* from tkinter import messagebox class WidgetDemo(): def _init__(self): window = Tk() window.title("Widgets Demo !") frame1 = Frame(window) frame1.pack() button1 = <space for pack> <space for main loop> def processButton(self): messagebox.
pyhton language
[28] Finish the following code in such a way that there will be a button displayed in the GUE When the button is clicked a message box will display "Welcome" from tkinter import from tkinter import messagebox class WidgetDemo(): def _init__(self): window = Tk() window.title("Widgets Demo !") frame1 = Frame(window) frame1.pack() button1 = <space for pack> <space for main loop> def processButton(self): messagebox.