Python: Unresolved reference 'myvar'

43 Views Asked by At

I am working on ttkbootstrap but it gives an error like this (https://i.stack.imgur.com/7mkxL.png)

I leave the codes below

my_label = ttk.Label(root, text="Click!", bootstyle=SUCCESS, font="Helvetica, 50")
my_label.pack(pady=50)

myvar = 0
def change():
    myvar += 1
    if myvar & 2 == 0:
        my_label.config(text="Selam")
    else:
        my_label.config(text="BB")

I tried something but it's not right

0

There are 0 best solutions below