Question

[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 me pyhton language
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()
                button1 = Button(text = "Click Here", command = self.processButton)
                button1.pack()
                
                #mainloop
                window.mainloop()
                
        #processButton()
        def processButton(self):
                #displaying "Welcome" using messagebox
                messagebox.showinfo("Demo!", "Welcome")

CODE SCREEN SHOT

1 from tkinter import * from tkinter import messagebox 2 #class Widget Demo lclass WidgetDemo() : # init method def init (sel

CODE WITH IMPLEMENTATION

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()
                button1 = Button(text = "Click Here", command = self.processButton)
                button1.pack()
                
                #mainloop
                window.mainloop()
                
        #processButton()
        def processButton(self):
                #displaying "Welcome" using messagebox
                messagebox.showinfo("Demo!", "Welcome")
                
#creating object for WidgetDemo
ob = WidgetDemo()

OUTPUT

х Widgets Demo! Click Here

x Demo! - Welcome OK

CODE SCREEN SHOT

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

Add a comment
Know the answer?
Add Answer to:
pyhton language [28] Finish the following code in such a way that there will be a...
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.

  • du Scholarshi... Ag Day Essay Cont... (22) Hig bb Question 30 10 [28] Finish the following...

    du Scholarshi... Ag Day Essay Cont... (22) Hig bb Question 30 10 [28] Finish the following code in such a way that there will be a button displayed in the GUI. When the button is clicked a message box will display "Welcome" from tkinter import from tkinter import messagebox class WidgetDemo(): def _init_(self): window = Tk0) window.title("Widgets Demo !") frame1 = Frame(window) frame 1.pack() button1 = <space for pack> <space for main loop> def processButton(self): messagebox.

  • " In the workshop exercises you have used Python's Tkinter module to create simple Graphical User Interfaces. The following code is an incomplete Python program relying on Tkinter (with delib...

    " In the workshop exercises you have used Python's Tkinter module to create simple Graphical User Interfaces. The following code is an incomplete Python program relying on Tkinter (with deliberately unhelpful variable and function names) which you must complete by filling in the blanks. When complete the program should create a window with two buttons, labelled and!!', respectively. When the button la belled'???' is pushed nothing happens. When the button labelled'!!"is pushed both buttons' labels are set to'!!!' from tkinter...

  • Python 3 Fix the code so if the user enter the same bar code more than...

    Python 3 Fix the code so if the user enter the same bar code more than three times, it shows a warning message indicating that the product was already tested 3 times and it reached the limits Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window,...

  • Im posting a python program and need to convert it to C++ language. import Tkinter import...

    Im posting a python program and need to convert it to C++ language. import Tkinter import Tkinter as tk from Tkinter import * import time def current_iso8601():     """Get current date and time in ISO8601"""     # https://en.wikipedia.org/wiki/ISO_8601     # https://xkcd.com/1179/     return time.strftime("%m.%d.%Y DATE %H:%M:%S TIME") class Application(tk.Frame):     def __init__(self, master=None):                 tk.Frame.__init__(self, master)         self.pack()         self.createWidgets()         def tstampIn(self):                 clockFile = open("clockTracker.txt","w")         print "You have successfuly Clocked In \n"         clockIn...

  • Python 3 Code does not save the data into excel properly ​​​​​​​ # required library import...

    Python 3 Code does not save the data into excel properly ​​​​​​​ # required library import tkinter as tk from tkcalendar import DateEntry import xlsxwriter # frame window = tk.Tk() window.title("daily logs") #window.resizable(0,0) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20) tk.Label(window, text="Failed date").grid(row=3, sticky="W", pady=20, padx=20) # entries barcode = tk.Entry(window) product = tk.Entry(window) money = tk.Entry(window) # arraging barcode.grid(row=0, column=1) product.grid(row=1, column=1) money.grid(row=2, column=1) cal =...

  • Python 3 How to change the icon in the error message want to put a yellow...

    Python 3 How to change the icon in the error message want to put a yellow warning icon import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20) tk.Label(window, text="sold by").grid(row=3, sticky="W", pady=20, padx=20) tk.Label(window, text="Failed date").grid(row=4, sticky="W", pady=20, padx=20) # entries barcode = tk.Entry(window) product =...

  • PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will...

    PYTHON PROGRAMMING LANGUAGE (NEEDED ASAP) Using a structured approach to writing the program: This section will guide you in starting the program in a methodical way. The program will display a window with GUI widgets that are associated with particular functions: Employee Payroll O X -- - - - - - - - - - - Show Payroll Find Employee by Name Highest Lowest Find Employee by Amount Write Output to Fie Cancel - -------- ------------- Notice that some of...

  • JAVA Hello I am trying to add a menu to my Java code if someone can...

    JAVA Hello I am trying to add a menu to my Java code if someone can help me I would really appreacite it thank you. I found a java menu code but I dont know how to incorporate it to my code this is the java menu code that i found. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; public class MenuExp extends JFrame { public MenuExp() { setTitle("Menu Example");...

  • In java language here is my code so far! i only need help with the extra...

    In java language here is my code so far! i only need help with the extra credit part For this project, you will create a Rock, Paper, Scissors game. Write a GUI program that allows a user to play Rock, Paper, Scissors against the computer. If you’re not familiar with Rock, Paper, Scissors, check out the Wikipedia page: http://en.wikipedia.org/wiki/Rock-paper-scissors This is how the program works: The user clicks a button to make their move (rock, paper, or scissors). The program...

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