При нажатии на кнопку печатается ошибка. (python3)
UnboundLocalError: local variable 'uni' referenced before assignment
Помогите. Вот мой код:
from tkinter import *
from os import *
root = Tk()
root.title("changer")
root.geometry("800x450")
unim = "changes"
global uni
uni = 1
def click1():
if uni == 1:
unim = "unit not ok"
uni = 2
elif uni == 2:
unim = "unit ok"
uni = 1
else:
uni = 1
app = Frame(root)
app.grid()
btn = Button(text="Change message", command=click1)
btn.grid()
lbl = Label(app, text = unim)
lbl.grid()
root.mainloop()
quit()