from tkinter import *
window = Tk()
window.geometry('600x600')
window.title(' Крестіки ноліки ')
w = 120
Button_list = []
class Btn():
global w
def _init_(self,x0,y0, idd):
self.idd = idd
self.x0 = x0
self.y0 =y0
self.button1.place(bg='white',bd=3)
self.button1 = Button().place(x=self.x1,y=self.y0,width=120,height=120)
self.button1.bind('<Button-1>', self.click)
def show(self):
idd = 0
x = 0
y = 0
for i in range(3):
for i in range(3):
Button_list.append(Btn(x,y,idd))
x += w
idd +=1
x = 0
y += w
def click(self, non):
print(self, idd)
Btn.show(0)
window.mainloop()
помилка:
Traceback (most recent call last):
File "B:\Pyton\+0.py", line 31, in <module>
Btn.show(0)
File "B:\Pyton\+0.py", line 23, in show
Button_list.append(Btn(x,y,idd))
TypeError: Btn() takes no arguments