Question

du Scholarshi... Ag Day Essay Cont... (22) Hig bb Question 30 10 [28] Finish the following code in such a way that there will
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

1 2 from tkinter import * from tkinter import messagebox 3 #class Widget Demo Elclass WidgetDemo() : + init method def init__

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

х Widgets Demo! Click Here

х Demo! - Welcome OK

CODE SCREEN SHOT

1 from tkinter import * from tkinter import messagebox 2 3 4 5 6 7 #class Widget Demo lclass WidgetDemo() : # init method def

Add a comment
Know the answer?
Add Answer to:
du Scholarshi... Ag Day Essay Cont... (22) Hig bb Question 30 10 [28] Finish the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • [28] Finish the following code in such a way that there will be a button displayed...

    [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...

    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.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT