I'm trying to learn the classes in Python.
I wrote a little code with tkinter
from tkinter import *
class window():
def __init__(self, size, title, ):
self.size = size
self.title = title
window = Tk()
window.geometry(self.size)
window.title(self.title)
print('a window has been created')
window.mainloop()
def button(self, window, text, x, y):
self.window = window
self.text = text
self.x = x
self.y = y
button = Button(window, text=text).place(x=str(x), y=str(y))
but I get the error message:
self.tk = master.tk
AttributeError: 'window' object has no attribute 'tk'
root = window('640x640', 'Root Window')root.button(root, 'test', "0", "0")