Home > Software engineering >  How can i set a value for IntVar tkinter?
How can i set a value for IntVar tkinter?

Time:01-18

i want to set True or False values for intvar how can i do it?

root = Tk()

intvar = IntVar()

# change value to 1

if intvar.get()==1:
    print('yes')

CodePudding user response:

You can initialize the variable when you create it by passing the value keyword argument:

intvar = IntVar(value=1)

At any time after that you can call the set method:

intvar.set(2)
  • Related