I cant create any shape with tkinter. Problem is only in this code, any other works fine.
import tkinter
okno = tkinter.Tk()
okno.geometry("1280x720")
platno = tkinter.Canvas(width = 1280, height = 720)
platno.pack()
okno.resizable(False, False)
okno.mainloop()
platno.create_rectangle(50,50,100,100)
I was trying to make a little game for fun. Ive started with window i made it i cant resize it. Then tried to create a rectangle at the canvas. But it doesnt work. This is the error:
Traceback (most recent call last):
File "C:\Users\Motix\Desktop\LOLKO.py", line 12, in <module>
platno.create_rectangle(50,50,100,100)
File "C:\Users\Motix\AppData\Local\Programs\Thonny\lib\tkinter\__init__.py", line 2835, in create_rectangle
return self._create('rectangle', args, kw)
File "C:\Users\Motix\AppData\Local\Programs\Thonny\lib\tkinter\__init__.py", line 2805, in _create
return self.tk.getint(self.tk.call(
_tkinter.TclError: invalid command name ".!canvas"