Tkinter'da butona bastığımda "'NoneType' object does not support item assignment" hatası alıyorum

import tkinter as tk
pencere = tk.Tk()
pencere.geometry("300x350")

sayı = 0
def islem():
    global sayı
    if sayı%2==0:
        buton['text'] = "X"
    else:
        buton['text'] = "Y"
    sayı += 1
def islem1():
    global sayı
    if sayı%2==0:
        buton1['text'] = "X"
    elif sayı%2!=0:
        buton1['text'] = "Y"
    sayı += 1
def islem2():
    global sayı
    if sayı%2==0:
        buton2['text'] = "X"
    else:
        buton2['text'] = "Y"
    sayı += 1
def islem3():
    global sayı
    if sayı%2==0:
        buton3['text'] = "X"
    else:
        buton3['text'] = "Y"
    sayı += 1
def islem4():
    global sayı
    if sayı%2==0:
        buton4['text'] = "X"
    else:
        buton4['text'] = "Y"
    sayı += 1
def islem5():
    global sayı
    if sayı%2==0:
        buton5['text'] = "X"
    else:
        buton5['text'] = "Y"
    sayı += 1
def islem6():
    global sayı
    if sayı%2==0:
        buton6['text'] = "X"
    else:
        buton6['text'] = "Y"
    sayı += 1
def islem7():
    global sayı
    if sayı%2==0:
        buton7['text'] = "X"
    else:
        buton7['text'] = "Y"
    sayı += 1
def islem8():
    global sayı
    
    if sayı%2==0:
        buton8['text'] = "X"
    else:
        buton8['text'] = "Y"
    sayı += 1
buton = tk.Button(text="", width=3,command=islem)
buton.place(x=75, y=75)
buton1 = tk.Button(text="k", width=3,command=islem1).place(x=115, y=75)
buton2 = tk.Button(text="", width=3,command=islem2).place(x=155, y=75)
buton3 = tk.Button(text="", width=3,command=islem3).place(x=115, y=115)
buton4 = tk.Button(text="", width=3,command=islem4).place(x=75, y=115)
buton5 = tk.Button(text="", width=3,command=islem5).place(x=155, y=115)
buton6 = tk.Button(text="", width=3,command=islem6).place(x=75, y=155)
buton7 = tk.Button(text="", width=3,command=islem7).place(x=115, y=155)
buton8 = tk.Button(text="", width=3,command=islem8).place(x=155, y=155)
pencere.mainloop()
    

Ben tkinter ile XOX oyunu yapmya çalışıyorum.
İlk buton istediğim gibi çalışıyor lakin diğer butonlara bastığımda
aşağıdaki hatayı alıyorum;

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\toshiba\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:/Users/toshiba/Desktop/pythonproje/xxxqw.py", line 23, in islem2
    buton2['text'] = "X"
TypeError: 'NoneType' object does not support item assignment

Yardımcı olursanız sevinirim

Merhaba, https://forum.yazbel.com/t/python-tkinter-attributeerror-nonetype-object-has-no-attribute-get-hatasini-cozemiyorum/10453 Burada benzer bir hata var, sebebi sizinkiyle aynı yönde

1 Beğeni

Veya bir örnek arıyorsanız da bu youtube linkini önerebilirim. Hemen hemen yazdıklarınız aynı zaten nerede hata var veya nereyi eksik yazmışsınız rahatlıkla görebilirsiniz diye düşünüyorum. Üstte yazılan yorumu da dikkate almadan da geçmeyin.

1 Beğeni

teşekkür ederim sorunu çözdüm

teşekkür ederim sorunu çözdümm