Question

In: Computer Science

1. Please use Python 3 programing. 2. Please share your code. 3. Please show all outputs....

1. Please use Python 3 programing.

2. Please share your code.

3. Please show all outputs.

Create a GUI Calculator with the following:

Title : Calculator

Label and Entry box for 1st Number

Label and Entry box for 2nd Number

Buttons for *, /, +, -

Label for result and Displaying the result

Solutions

Expert Solution

from Tkinter import *
class MyWindow:
    def __init__(self, win):
        self.lbl1=Label(win, text='First number')
        self.lbl2=Label(win, text='Second number')
        self.lbl3=Label(win, text='Result')
        self.Calculator1=Entry(bd=3)
        self.t2=Entry()
        self.t3=Entry()
        self.btn1 = Button(win, text='Add')
        self.btn2=Button(win, text='Subtract')
        self.lbl1.place(x=100, y=50)
        self.Calculator1.place(x=200, y=50)
        self.lbl2.place(x=100, y=100)
        self.t2.place(x=200, y=100)
        self.b1=Button(win, text='Add', command=self.add)
        self.b2=Button(win, text='Subtract')
        self.b2.bind('<Button-1>', self.sub)
        self.b3=Button(win, text='Multiply')
        self.b3.bind('<Button-1>', self.mul)
        self.b4=Button(win, text='Devide')
        self.b4.bind('<Button-1>', self.div)
        self.b1.place(x=100, y=150)
        self.b2.place(x=200, y=150)
        self.b3.place(x=300, y=150)
        self.b4.place(x=400, y=150)
        self.lbl3.place(x=100, y=200)
        self.t3.place(x=200, y=200)
    def add(self):
        self.t3.delete(0, 'end')
        num1=int(self.Calculator1.get())
        num2=int(self.t2.get())
        result=num1+num2
        self.t3.insert(END, str(result))
    def sub(self, event):
        self.t3.delete(0, 'end')
        num1=int(self.Calculator1.get())
        num2=int(self.t2.get())
        result=num1-num2
        self.t3.insert(END, str(result))
    def mul(self,event):
        self.t3.delete(0, 'end')
        num1=int(self.Calculator1.get())
        num2=int(self.t2.get())
        result=num1*num2
        self.t3.insert(END, str(result))
    def div(self, event):
        self.t3.delete(0, 'end')
        num1=int(self.Calculator1.get())
        num2=int(self.t2.get())
        result=num1/num2
        self.t3.insert(END, str(result))

window=Tk()
mywin=MyWindow(window)
window.title('Hello Python')
window.geometry("500x300+10+10")
window.mainloop()


Related Solutions

1. Please program the following in Python 3 code. 2. Please share your code. 3. Please...
1. Please program the following in Python 3 code. 2. Please share your code. 3. Please show all outputs. Instructions: Run Python code  List as Stack  and verify the following calculations; submit screen shots in a single file. Postfix Expression                Result 4 5 7 2 + - * = -16 3 4 + 2  * 7 / = 2 5 7 + 6 2 -  * = 48 4 2 3 5 1 - + * + = 18   List as Stack Code: """...
Use the data in Table 2.0, answer questions 1, 2, & 3. Please show all of...
Use the data in Table 2.0, answer questions 1, 2, & 3. Please show all of your working. Table 2.0 Data for a sample of 50 individual in a Cardiovascular Disease Study Participant ID Weight (kg) Height (cm) Smoking status Blood glucose 1 70 165 1 107 2 60 162 0 145 3 62 150 1 237 4 66 165 1 91 5 70 162 0 185 6 59 165 0 106 7 47 160 0 177 8 66 170...
Please solve all of the questions, questions 1, 2, and 3. Please show all work and...
Please solve all of the questions, questions 1, 2, and 3. Please show all work and all steps. 1.) Find x(t) = Σ aktk such that tx'' = x 2.) Find x(t) = Σk>=0 aktk such that x'' = tx + 1 and x(0) = 0, x'(0) = 1 3.) Using the Frobenius method, solve t2x'' - 3tx' + (4-t)x = 0
Hi there, please write code in Python 3 and show what input you used for the...
Hi there, please write code in Python 3 and show what input you used for the program. I've been stuck on this for hours! (1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes; more volunteers, more civilians, more teachers in space. nothing ends here;...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of...
Write a R-script to (and show the outputs of your code) (a) Create a sequence of numbers starting at 3.5 and ending at 10.7 with increments of 0.79. Find the variance and mean of those numbers. And finally sort the vector in a decreasing manner (b) Create a 3 different 3 by 3 matrices such that each of the numbers 1,2,...,9 appear exactly once (Sudoku style) in each of the matrices.
Please show fully functioning Java code and screenshots of outputs. Please separate by 1a and 1b....
Please show fully functioning Java code and screenshots of outputs. Please separate by 1a and 1b. #1. Design a Java JProduct class for a product which implements both cloneable and comparable interfaces The class should have the following private member variables: m_id: an integer that holds the product ID m_name: a string that holds the product name m_wholesaleprice: a double that holds the wholesale price m_retailers: a String array that holds all retailers who sell the product and the class...
Please use the python and explain. Also please show python. Suppose that a cashier owes a...
Please use the python and explain. Also please show python. Suppose that a cashier owes a customer some change and that the cashier only has quarters, dimes, nickels, and pennies. Write a program the computes the minimum number of coins that the cashier can return. To solve this problem use the greedy algorithm explained below. PROBLEM STATEMENT: Your program should first ask the user for the amount of money he/she is owed (in dollars). You may assume that the user...
Please show all work and explain. 3. A share of stock sells today for $52.50. The...
Please show all work and explain. 3. A share of stock sells today for $52.50. The beta of the stock is 1.18. The expected return on the overall market is 10.6% and the risk free rate is 2.5%, What is the overall expected return of the stock? If there is to be a dividend of $1.68 at the end of the year, what should be the price of the stock at the end of the year? If the price of...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods...
Please show screenshot outputs and fully functional code for the Java program. Write the following methods to   1) read the content of an array of 5 doubles public static double[] readingArray() 2) find and print:the smallest element in an array of 5 double public static void smallest(double [] array) 3) find and print:the largest element in an array of 5 doubles pubic static void largest (double [] array) In the main method - invoke readingArray and enter the following numbers...
a) write a python programme for converting url.to html please provide valid code and please share...
a) write a python programme for converting url.to html please provide valid code and please share screenshots to me
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT