I am trying to make a simple calculator with Python Tkinter. Below you can see a piece of code and a variable "sign" in it. I want the variable to serve as a way to tell the program that addition button of my calculator was pressed.
def addition():
sign = "+"
first_number = e.get()
global first_converted
first_converted = int(first_number)
e.delete(0, END)
Further in the code, I want to make a function that will contain "if" statements for all of the scenarios of pressed buttons e.g. addition, division, multiplication, etc. However, Python does not see variable "sign".
def count():
if sign == "+":
pass
e.delete(0, END)
pass
I have tried declaring variable as global in the beginning of the code, but it did not help.