tkinter-canvas

Is there a way to destroy a Tkinter object that is stored in a list?

Is there a way to destroy a Tkinter object that is stored in a list? Question: I’m trying to display a lot of appearing and disappearing object in Tkinter. I store those in a normal list for easy access and to be easily able to loop through them. I also want some of the objects …

Total answers: 1

Unexpected Grid behavior in Tkinter

Unexpected Grid behavior in Tkinter Question: I am coding a game in Python with tkinter. The basic functionality is that an image is displayed but it’s covered with a grid of boxes that can be destroyed. I’ve written a linear version of the code that is as simplified as I can get it: from tkinter …

Total answers: 1

Tkinter – Scroll with mousepad / mouse gestures / two fingers scrolling in tkinter?

Tkinter – Scroll with touchpad / mouse gestures / two fingers scrolling in tkinter? Question: I wanted to implement two finger scrolling in tkinter. Here is the result of my own attempt: import tkinter as tk class Scene: def __init__(self, canvas): self.canvas = canvas self.elements = [ { "type": "rect", "x": canvas.winfo_width() / 2, "y": …

Total answers: 1

Trouble with the Tkinter Grid manager when a canvas is placed in window

Trouble with the Tkinter Grid manager when a canvas is placed in window Question: Python, tkinter, I’m trying to write a program that takes a file and uses its contents to drawl a picture. I can’t get the grid manager to line the widgets up correctly. I want it to look like the first picture, …

Total answers: 1

Dynamically Resize only the image in tkinter GUI

Dynamically Resize only the image in tkinter GUI Question: I have been attempting to create a GUI with sliders and buttons with an output image to the right (NOT background image). A requirement is for only the image to dynamically change size based on the window size. In my attempt the window properly displays a …

Total answers: 1

How do I use binding to change the position of an arc?

How do I use binding to change the position of an arc? Question: I am having trouble setting the x position of an arc called "pac_man", and then changing it using += with a function called "xChange()". I have tried multiple things, but I think using a dictionary would suffice. This is because the variable …

Total answers: 1

Frame border disappears when focus is lost on window

Frame border disappears when focus is lost on window Question: I have a tkinter window from which I open another window. This window contains a Frame which is located inside a Canvas. I’m going to make a picture from the window contents but the problem is that the frame border deactivates itself when the focus …

Total answers: 1

How can I bind a key-event to a Python tkinter canvas item?

How can I bind a key-event to a Python tkinter canvas item? Question: I want to bind a key event to a Python tkinter canvas item, for example to a rectangle. I am able to bind a key to the canvas itself (see example code, key "a", "b", "c"), but not to a canvas-item as …

Total answers: 1

Why does a redundant window appear in a TKinter checkbox?

Why does a redundant window appear in a TKinter checkbox? Question: Thanks to @Bryan Oakley, as I use an answer of his in this post: (Variable size list of Checkboxes in Tkinter?). Everything is OK, except that when I run the script, a redundant window appears. How can I get rid of it? import Tkinter …

Total answers: 1