Question

Please, build calculator to exact image as below using Python.

Write a GUI that implements the calculator shown in the following image: Calculator х Plus Equals: Add Clear Quit - User ente

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

from tkinter import *
from tkinter import ttk

window=Tk()
window.title('Calculator')
window.geometry(('%dx%d')%(350,110))

num1=StringVar()
num2=StringVar()


v=StringVar()

def showun():
    global v
    num3=num1.get()
    num4=num2.get()
    num5=int(num3)+int(num4)
    v.set(str(num5))  
  

def clear():
    global num1
    global num1
    num1.set("")
    num2.set("")
  
  

def quitw():
    window.withdraw()

  
frame1=Frame(window,height=350,width=110)
frame1.grid(column=1,row=0,padx=100)  

entry1=Entry(frame1,textvariable=num1).grid(row=0,column=2)
label1=Label(frame1,text="Plus").grid(row=1,column=2)
entry2=Entry(frame1,textvariable=num2).grid(row=2,column=2)
label2=Label(frame1,text="Equals:").grid(row=3,column=2)
label2=Label(frame1,text="",textvariable=v).grid(row=3,column=2,padx=(115,50),sticky=W)

frame2=Frame(window,height=350,width=150)
frame2.grid(column=1,row=1)

button1=Button(frame2,command=showun,text='Add').grid(row=4,column=0)
button1=Button(frame2,command=clear,text='clear').grid(row=4,column=1)
button1=Button(frame2,command=quitw,text='quit').grid(row=4,column=2)

Calculator X 11 Plus 22 Equals: 33 Add clear quit

Add a comment
Know the answer?
Add Answer to:
Please, build calculator to exact image as below using Python. Write a GUI that implements the...
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
  • Write a GUI-based Java application that implements the "Math Game" shown below. The program asks the...

    Write a GUI-based Java application that implements the "Math Game" shown below. The program asks the user to enter the answer of multiplying two one-digit random integers.  If the user enters a correct answer, a message will be displayed at the bottom of the frame, and the text field will be cleared.  If the user enters a wrong answer, a message will be displayed at the bottom of the frame asking for another answer.  If the user...

  • Please code the following Java App using Swing No additional classes are required. With that in...

    Please code the following Java App using Swing No additional classes are required. With that in mind ... Write a program that emulates a calculator. Create a Label with a title of "Super Calculator", a textbox, where the numbers are displayed, a series of buttons labeled as shown, and a “Clear” button. As the user enters the numbers, pressing the number buttons, display the numbers right justified to the textbox. When the user press any one of the operators, +,...

  • Calculator = 0.01 Calculate . Add O subtract O Multiply ODvide uttons on the right determine the operation that is perf...

    Calculator = 0.01 Calculate . Add O subtract O Multiply ODvide uttons on the right determine the operation that is performed on the numbers. For example, the following image shows values 12 and 3 are entered in the ion in selected. When the Calculate button is pressed, the result of the addition operation is shown after the equal sign ( In this example, the result is 1 Calculator 12 .15.01 Calculate | ⓔAdd subtract。Multiply O Divide g images show the...

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

  • C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to...

    C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to create a Windows Form Application that will mimics a calculator. This is the screenshot how it shouldl look like. Calculator It should have a textbox and the following buttons: + Addition - Subtraction * Multiplication / Division = Equals (Will perform the final calculation) C Clear (Will clear the text box) There will be no maximize or minimize buttons. The rules are these: 2...

  • Using Java, please design the GUI in the following prompt. PLEASE TEST YOUR PROGRAM. Thanks! Write...

    Using Java, please design the GUI in the following prompt. PLEASE TEST YOUR PROGRAM. Thanks! Write a program that displays three buttons with the names or images of three candidates for public of office. Imagine that a person votes by clicking the button that shows the candidate of his/her choice. Display the current number of votes above each button. Include a Finished button that erases the images of the losers and displays only the winner's image with a message of...

  • You may adjust the code as you want. Thank you! CODING HERE: import javafx.application.Application; import javafx.event.*;...

    You may adjust the code as you want. Thank you! CODING HERE: import javafx.application.Application; import javafx.event.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.*; import javafx.geometry.*; public class OrderSystem extends Application implements EventHandler<ActionEvent> { // Attributes for GUI private Stage stage; // The entire window, including title bar and borders private Scene scene; // Interior of window private BorderPane layout; // Add four labels private Label itemLabel = new Label("Item Name:"); private Label numberLabel = new Label("Number:"); private Label costLabel...

  • You are to write a program that implements a Reverse Polish Notation Calculator in C using...

    You are to write a program that implements a Reverse Polish Notation Calculator in C using BISON and FLEX, You only have to edit the BISON and FLEX files. Link to the files to start and have a general view of the program: https://www.dropbox.com/sh/83yzs66jhftqj5b/AABZcY9Qwl84JdUFnYpQaZk9a?dl=0 Reverse Polish Notation is a mathematical notation in which every operator follows all of its operands. It is sometimes called postfix notation, and does not require any parentheses as long as each operator has a fixed...

  • Write a MATLAB Graphical User Interface (GUI) to simulate and plot the projectile motion – the...

    Write a MATLAB Graphical User Interface (GUI) to simulate and plot the projectile motion – the motion of an object projected into the air at an angle. The object flies in the air until the projectile returns to the horizontal axis (x-axis), where y=0. This MATLAB program should allow the user to try to hit a 2-m diameter target on the x-axis (y=0) by varying conditions, including the lunch direction, the speed of the lunch, the projectile’s size, and the...

  • Java: In this assignment, you will create an accumulator accumulator-calculator that displays a sad face “...

    Java: In this assignment, you will create an accumulator accumulator-calculator that displays a sad face “ :-( “ whenever the number displayed by the calculator is negative and a happy face “ :-) ” whenever the number displayed is positive. The calculator responds to the following commands: num + , num - , num * , num / and C ( Clear ). After initial run, if the user clicks 8 and then presses the “+” button for example, the...

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