0

I am trying to make a button change when it is pressed but the configure function when I use it returns the error:

A1.config(text="X", state="disabled", relief="SUNKEN")
AttributeError: 'NoneType' object has no attribute 'config'

I also tried using configure instead of config and the response is the same:

    A1.configure(text="X", state="disabled", relief="SUNKEN")
AttributeError: 'NoneType' object has no attribute 'configure'

(for reference) the button:

A1 = Button(window,text="",width=5, height=1, command=click).place(x=100, y=100)

the command:

def click():
    A1.configure(text="X", state="disabled", relief="SUNKEN")

1 Answers1

0

You can't define a variable and place it in the same line. Try this:

A1 = Button(window, text="", width=5, height=1)
A1.place(x=100, y=100)

also "SUNKEN" isn't valid, either do "sunken" or SUNKEN

Libra
  • 2,544
  • 1
  • 8
  • 24