I have 3 buttons I want to make it so when you press a button it sets the variable to a value. press 1st button sets x to 1 2nd set y to 2 press 3rd add x and y together should return with 3 but it returns with 0.
I tried to make a 4th value where when it is set to 1 it would add both together. me and a friend tried making x and y at the beginning and integer int(x)= x
here is the code
import tkinter
window_main = tkinter.Tk(className='Tkinter - TutorialKart', )
window_main.geometry("400x200")
i=0
x=0
y=0
o = 0
p = 0
x = int(x)
y = int(y)
o = int(o)
p = int(p)
i=int(i)
def submitFunction() :
  x = 1
  print(x)
if o == 1:
  x = 1
def a2():
  y = 2
  print(y)
if p == 1:
  y = 2
def equ():
  i = int(x + y)
  return(i)
  print(i)
button_submit = tkinter.Button(window_main, text ="set x to 1", command=submitFunction).grid(column = 1, row = 1)
button = tkinter.Button(window_main, text ="set y to 2", command=a2).grid(column = 2, row = 1)
button = tkinter.Button(window_main, text = "solve", command = equ). grid(column = 3, row = 1)
window_main.mainloop()
 
     
    