Mar-28-2019, 10:12 PM
I wrote this code but i need help with finishing it, i cant get the button to complete the equation, im net to python and coding btw..
from tkinter import * master = Tk() master.title("Calculator") #Labels Label(master, text="Number 1:").grid(row=0, column=0) Label(master, text="Number 2:").grid(row=1, column=0) Label(master, text="Operator:").grid(row=2, column=0) #Enter num1 = Entry(master).grid(row=0, column=1) num2 = Entry(master).grid(row=1, column=1) operator = Entry(master).grid(row=2, column=1) enter = Button(master, text="Enter").grid(row=3, column=1) times = (num1 * num2) minus = (num1 - num2) divide = (num1 / num2) plus = (num1 + num2) if enter == true: if operator == "*": print(times) if operator == "-": print(minus) if operator == "/": print(divide) if operator == "+": print(plus) master.mainloop()