canvas

Find an object that other canvas object is overlapping with – Python tkinter

Find an object that other canvas object is overlapping with – Python tkinter Question: I want to detect with what canvas object block. We have block, circle and triangle canvas objects. I know there is if block in canvas.find_overlapping(x1,y1,x2,y2): method but doesn’t shows with what object is block overlapping. It just shows if block is …

Total answers: 1

Set Author, Title, and Subject for PDF using Reportlab

Set Author, Title, and Subject for PDF using Reportlab Question: How can you correctly set the Author, Title and Subject attributes for a PDF File using Reportlab? I have found the methods in the Reportlab User Guide on page 56, but I am not sure how to implement them correctly. Below in my PDF cropping …

Total answers: 2

Tkinter error: Couldn't recognize data in image file

Tkinter error: Couldn't recognize data in image file Question: I’m trying to put a jpg image to a tkinter canvas. tkinter gives me this error: couldn’t recognize data in image file I use the code from the documentation: canv = Canvas(root, width=80, height=80, bg=’white’) canv.grid(row=2, column=3) img = PhotoImage(file=”bll.jpg”) canv.create_image(20,20, anchor=NW, image=img) Same thing with …

Total answers: 11

Python tkinter frame canvas resize

Python tkinter frame canvas resize Question: I’m attempting to resize a canvas so the canvas fills the entire window when the window is resized by the user employing a ‘click and drag’ on the window edge, but I am not successful. I have looked at the following other questions: Question #1 (previously posted, but not …

Total answers: 2

Tkinter canvas zoom + move/pan

Tkinter canvas zoom + move/pan Question: Tkinter’s canvas widget has built-in features to: move/pan the canvas (for example with Click + Drag) with canvas.scan_mark and canvas.scan_dragto, see this question zoom the vector elements on the canvas with canvas.scale, but sadly, this doesn’t work for bitmap images on the canvas Fortunately, this method allows zooming of …

Total answers: 3

Tkinter .pack() window not showing?

Tkinter .pack() window not showing? Question: I’ve been working on a simple program that make a button output something. But when i run it, this (I got this from the internet btw) does not show up. Is somethoing wrong with the code or something? Please help me so the window above can appear 🙂 Code: …

Total answers: 2

How to get tkinter canvas to dynamically resize to window width?

How to get tkinter canvas to dynamically resize to window width? Question: I need to get a canvas in tkinter to set its width to the width of the window, and then dynamically re-size the canvas when the user makes the window smaller/bigger. Is there any way of doing this (easily)? Asked By: Annonymous || …

Total answers: 4

Canceling events after the .after() method has been called on them?

Canceling events after the .after() method has been called on them? Question: I’m writing a little game with python tkinter module using a canvas widget. There is the person, who is just a ball, and bombs that spawn every 10 seconds. 3 seconds after a bomb spawns, it begins a process of “exploding” which I …

Total answers: 3