So i have the problem that i need to save out the drawing to a .png file with the same size of the canvas, but after converting the canvas into postscript with (width, height) params it gives back a 751x752 sized .png file. I read somewhere that the postscript automatically strips the canvas. I need the original size. Thanks for helping!
Here's a piece from the code: With the draw function you can draw something in to the canvas and the goal is to save the drawing.
def draw(event):
x, y = event.x, event.y
r = 20
canvas.create_oval(x - r, y - r, x + r, y + r, fill='black')
canvas = CTkCanvas(self.game_started_window, width=1000, height=1000, bg='white')
canvas.place(x=900, y=0)
canvas.bind('<B1-Motion>', draw)
def save_png():
postscript = canvas.postscript(colormode = 'color', width = 1000 ,height =1000)
img = Image.open(io.BytesIO(postscript.encode('utf-8')))
img.save(f'samples/comp.png', format = 'png')