Question

Attached is an incomplete Python template file. button_get4_Q.py Download this file and complete it to solve the following pr

0 0
Add a comment Improve this question Transcribed image text
Answer #1

input , output screen shots are provided and simple comments are included for explanations. Please feel free to make any changes if required.

Thank You.

Source code:

import tkinter as tk
class gui:
def __init__(self,m):
self.mn = m #Creates window
self.mn.title("Get4") #sets window title
#Created a text area with font size and using width and height attribs
self.t1 = tk.Text(m,font=(32),width=14,height = 2)
self.t1.grid(row=0,column=0,columnspan=5, pady=5)
#created five buttons for five numbers and arranged them using grid
self.b1=tk.Button(m,text="1",command=lambda:self.ins("1"))
self.b1.grid(row=1,column=0,padx=5, pady=5)
self.b2=tk.Button(m,text="2",command=lambda:self.ins("2"))
self.b2.grid(row=1,column=1,padx=5, pady=5)
self.b3=tk.Button(m,text="3",command=lambda:self.ins("3"))
self.b3.grid(row=1,column=2,padx=5, pady=5)
self.b4=tk.Button(m,text="4",command=lambda:self.ins("4"))
self.b4.grid(row=1,column=3,padx=5, pady=5)
self.b5=tk.Button(m,text="5",command=lambda:self.ins("5"))
self.b5.grid(row=1,column=4,padx=5, pady=5)
#One more button for reset option
self.b6=tk.Button(m,text="RESET",command=self.reset)
self.b6.grid(row=2,column=0,columnspan=5,padx=5, pady=5)
#function for five buttons
def ins(self,val):
v = self.t1.get('1.0','end-1c')
if len(v)<4:
self.t1.insert(tk.END,val)
#reset button function
def reset(self):
self.t1.delete('1.0',tk.END)

root=tk.Tk()
gui = gui(root)
root.mainloop()

import tkinter as tk class gui: def __init__(self,m) : self.mn = m #Creates window self.mn.title(Get4) #sets window title #
output:

4321 RESET

Add a comment
Know the answer?
Add Answer to:
Attached is an incomplete Python template file. button_get4_Q.py Download this file and complete it to solve...
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
  • Hello I just need the code for this GUI thanks Also computer screenshot of the code...

    Hello I just need the code for this GUI thanks Also computer screenshot of the code will be helpful Attached is an incomplete Python template file. button_multi_colour_changer_Q.py Download this file and complete it to solve the following problem. Consider the GUI below (4 Labels, 4 colour Buttons and a "RESET" Button) which has been produced with a Python program using the Tkinter library. MULTI Button Colour - a X MULTI Button Colour - O X Violet Purple Blue | Green...

  • Python Consider the GUI below (3 Labels and 3 Radiobuttons) which has been produced with a Python program using the Tkinter library.   You are required to write a Python program to produce this inte...

    Python Consider the GUI below (3 Labels and 3 Radiobuttons) which has been produced with a Python program using the Tkinter library.   You are required to write a Python program to produce this interactive GUI. Your GUI must replicate the example above as closely as possible, including the same widgets displayed in the sample positions on the GUI, using the same colours, shapes and relative sizes. (Note that the GUI border in the sample output does not need to be...

  • " 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...

  • GUI Programming Creating a Kilometer to Miles Converter Lab Assignment Objectives Understand the basics of tkinter...

    GUI Programming Creating a Kilometer to Miles Converter Lab Assignment Objectives Understand the basics of tkinter GUI development. Based on an informal application specification be able to develop a tkinter GUI program that contains one or more Label widgets. Be able to prompt user for input to a GUI application using a messagebox. Obtain user input into a GUI application that can be used for event driven selection. Be able to develop a tkinter GUI program that supports event-based widgets....

  • I need help creating a code for the problem in Python. Joe's Automotive Joe's Automotive performs the following routine maintenance services: Oil change-$30.00 . Lube job-$20.00 Radiator flus...

    I need help creating a code for the problem in Python. Joe's Automotive Joe's Automotive performs the following routine maintenance services: Oil change-$30.00 . Lube job-$20.00 Radiator flush-$40.00 Transmission flush-$100.00 Inspection-$35.00 Muffler replacement-$200.00 Tire rotation- $20.00 Write a GUI program with check buttons that allow the user to select any or all of these services. When the user clicks a button, the total charges should be displayed Joe's Automotive Joe's Automotive performs the following routine maintenance services: Oil change-$30.00 ....

  • ****THIS IS A 2 PART QUESTION! I ONLY NEED THE ANSWER TO PART 2 ON HOW...

    ****THIS IS A 2 PART QUESTION! I ONLY NEED THE ANSWER TO PART 2 ON HOW TO SEND THE DATA SERIALIZED**** Write a c# program that stores student grades in a text file and read grades from a text file.  The program has the following GUI: There are four buttons: Create File, Save Case, Close File and Load File.  Initially, only the Create File and Load File buttons are enabled.  If the user clicks the Create File button, a Save File Dialog window...

  • QUESTION 3 [49 MARKS 3.1) Write the Java statements for a class called Calculator to produce...

    QUESTION 3 [49 MARKS 3.1) Write the Java statements for a class called Calculator to produce the GUI below. Use 3 panels to arrange the components. You must use an array when defining the numbered buttons (o-9. Do not declare 10 buttons individually. The textfield must be initialized with the text as shown below, and be able to accommodate up to 25 characters. The spacing between the numbered buttons is 10. (28) for caloula Add Equals 3.2 Rewrite any existing...

  • for python Introduction The purpose of this assignment is to familiarize you with the writing Python...

    for python Introduction The purpose of this assignment is to familiarize you with the writing Python scripts that demonstratest usage GUI programming. Long-Distance Calls A long-distance provider charges the following rates for telephone calls: Rate Category Daytime 6:00 a.m. through 5:59 p.m.) Evening (6:00 p.m. through 11:59 p.m.) Off-Peak (midnight through 5:59 a.m.) Rate per Minute $ 0.07 $ 0.12 $ 0.05 Write a GUI application that allows the user to select a rate category (from a set of radio...

  • 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 CODING Must be compilable, thanks The purpose is to provide an exercise in event-driven programming...

    JAVA CODING Must be compilable, thanks The purpose is to provide an exercise in event-driven programming and image handling using JavaFX. Create an application that responds to the user clicking command buttons. Initially, it will display one of two graphic images and, based upon the button clicked by the user, will switch the image displayed. If the user clicks the mouse button to display the same image as is currently displayed, the image is not changed, but a message at...

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