Skip to content
Advertisement

My variables don’t want to show up even after i define them it gives me an error that the variable doesn’t exist

this is the problem with the code because I don’t know how to properly explain it

Here is the code in typed form as well

        def convert6(tog = [0]):

        tog[0] = not tog[0]
        if tog[0]:
            print('Server DIF Hard ON')
            difHardS = 1

        else:
            print('Server DIF Hard OFF')
            difHardS = 0

    button3 = tk.Button(self, text="Hard", command=convert6, height=2, width=20)
    button3.pack()
if difHardS = 1:

Advertisement

Answer

You are using difHardS variable within the method (I assume) which is nowhere defined in the method. This is the problem that the editor describes.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement