Questions tagged [tkinter-canvas]
The Canvas widget provides structured graphics facilities for Tkinter. This is a highly versatile widget which can be used to draw graphs and plots, create graphics editors, and implement various kinds of custom widgets.
1,978
questions
0
votes
1
answer
42
views
trouble with Tkinter tags
I've been trying to make a functioning "undo" button for a sketchpad on a Tkinter canvas, and have been having some problems. Here's code:
from tkinter import ttk
from tkinter import *
root ...
0
votes
1
answer
33
views
Tkinter - Struggling to Add a Frame Which is Scrollable
I'm trying to create a system that allows you to add checks into a profile using a gui. I want the checks to be in their own frame that has a scroll wheel because I don't know how many checks a ...
1
vote
1
answer
26
views
How to make a image vertical in Tkinter using canvas
I am working on a project atm, and i am trying to figure out a way to make my image vertical, ill be using a monitor turned vertically so i need all my information vertical:
img = ImageTk.PhotoImage(...
-1
votes
0
answers
45
views
Tkinter how to pass variable to another page
Im trying to password strength meteor app with gui. My expectation is i will get username and passwords from page 1 from entry 1 entry2 and pass to page 2 and page 2 do calculations and outputs it.I'm ...
0
votes
1
answer
32
views
Tkinter 2 button placed in same place
I'm trying to program with gui . Also i used tkinter designer and trying to make gui with 2 page.When i run program it shows page 1 but button of first page and button of second page appear in same ...
0
votes
0
answers
34
views
I have two texts above each other in canvas (tkinter), and I want to dynamically resize them with the window
I have two texts in canvas (tkinter), below each other. When I lower the window's width, the text gets smaller and always fits on the screen. However, when I lower the height, the text doesn't get as ...
0
votes
0
answers
42
views
Can i over draw more elements into a canvas in tkinter?
i want to know if there is a way to draw more elements into a canvas in tkinter. My goal is to display in a canvas a trajectory made with plotnine and two circles as the boundaries like in the ...
-1
votes
0
answers
32
views
Tkinter image not showing and page 2 show first at instead of 1
i tried to gui app using tkinter designer and made 2 seperate frame and i need final gui as 2 frames switching. But when i run this code some images not showing and frame 2 showing first
from pathlib ...
1
vote
1
answer
37
views
Tkinter Canvas - 2px internal padding appearing
I noticed a strange behavior with the Tkinter Canvas implementation. Here is a small snippet to highlight this behavior.
shall_configure_innerframe = False
shall_configure_periodically = False
from ...
0
votes
1
answer
88
views
tkinter screenshot with mss not working as expected
essentially the problem is: I want to take a screenshot of my tkinter canvas.
Unfortunately I am not able to understand PIL, so don't gaslight me with Pillow or ImageGrab please.
from mss import mss
...
1
vote
1
answer
64
views
Unable to drag window due to tkinter after command
I have a small function to create scrolling text within a tkinter canvas. It works well except I cannot drag the containing window. I suspect this is because the time period is quite short. Any ...
0
votes
0
answers
25
views
Scrolling Tkinter, how could I stop when the canvas in down of the window?
I'm beginner, I'm trying to setup the scroll on a Tkinter window. But I can scroll to up and down to infinite. I didn't find how I can block the scroll when I see the up of the canvas and the down. ...
0
votes
2
answers
69
views
How can I move a tkinter canvas-window by the mouse-pointer?
I have a tkinter Canvas where some objects are placed and can be moved by the mouse pointer. One of these objects is a text, which is not implemented as canvas-text-item but as a text-widget in a ...
-1
votes
1
answer
58
views
Tkinter Python - Treeview
def add_laytime(self):
self.variaveis()
self.conecta_bd()
self.cursor.execute("""
INSERT OR IGNORE INTO laytime (vessel, comm, destino, weight, ...
0
votes
0
answers
44
views
Python Tkinter set not updating with new ID's when shift key is used to allow 'multi-select'
I'm building an app using python and tkinter that allows a user to select boxes drawn on a canvas. I am trying to implement a 'multi-select' feature where the user may hold down the shift key and then ...
0
votes
0
answers
40
views
Removing focus for tkinter widgets with clicks outside the frame but within the window
I'm a google learned hobbyist programmer for a while now. Gotta say thanks for Stack and everyone here.
working to create a modified Tkinter listbox where I want to bind or unbind an event based on ...
-1
votes
0
answers
47
views
Cannot zoom properly a Canvas in Tkinter
I am facing an annoying problem with Tkinter, I hope you can help me.
With the following code I create an empty plot in a window. I want to maximize that window (no problem there) and to maximize the ...
1
vote
0
answers
38
views
Tkinter itemcget not working as intended. Can't print when saved in a variable
def choose_word():
card_num = random.randint(0, len(french_vocab_list))
canvas.itemconfig(french_word, text=french_vocab_list[card_num])
test = canvas.itemcget(card_front, 'state')
...
0
votes
0
answers
21
views
What steps need to be taken to delete previously drawn objects when the rectangle for user interaction is shifted to a new position?
I'm working with a tkinter canvas to build a geospatial project with an area containing randomly placed points. I'm using a rectangle for interaction and implementing a quadtree algorithm within this ...
0
votes
1
answer
44
views
How to share mouse coordinates between 2 class
The goal is to reproduce, in canvas classB, the drawing (example with vertical line) made with the mouse in canvas classA.
To do this, I need to transfer the mouse coordinates from one class to ...
0
votes
0
answers
28
views
Tkinter Canvas, hiding 100 objects using "tag" vs iterating through the ids of 10 objects and setting their state to "hidden". Which is faster?
Using the canvas in python tkinter, I'm hiding multiple objects these are my two approaches, which is more efficent?
Method 1
#This method iterates through the existing objects and sets their state to ...
0
votes
1
answer
30
views
Scrollbar Tkinter not scrolling
I have a scroll bar on tkinter but it doesn't let me scroll the page, when I scroll it does not move at all. (The scrollbar is there)
def new_window(serial, model, n_comp, ):
newwindow = Toplevel(root)...
0
votes
1
answer
36
views
The workspace in Tkitner Canvas is smaller than the widget
I'm trying to output some rectangles with text in a grid. But the second column is not drawn all the way through.
from tkinter import Tk, Canvas, Frame, BOTH
class Flowchart(Frame):
def __init__(...
0
votes
0
answers
102
views
Invalid command name while executing - tk- python
Edit: updated code
I want to run several TK class instances, consecutively from another python file. To achieve this, I have created a TK class in a python file named GUI_file.py
import os
import cv2
...
0
votes
1
answer
66
views
Canvas frame doesn't extend to window size in Tkinter Python
I have created a frame using canvas for scrolling since I have added multiple buttons inside that frame. but the problem is when I make the tkinter window maximized the frame doesn't fill to the ...
3
votes
2
answers
67
views
Python Turtle detect mouse release event on screen, not a turtle
How do you detect a mouse release event on a turtle screen? There is only onscreenclick but no corresponding release event. Is there something I can do using the tkintercanvas backend?
0
votes
1
answer
48
views
Make canvas size be the size of its content
i am trying to build a user interface with Tkinter.
In doing so i used a canvas as a container (because a canvas is scrollable and a frame is not).
However I noticed that a canvas does not behave like ...
0
votes
1
answer
37
views
How to control the zorder of polygons
I have modified the Poly Editor (from the gallery of Matplotlib) to make it able to load several polygons at a time. This works fine except on one point: I don't know how to control the zorder of the ...
0
votes
0
answers
18
views
How to refresh Tkinter canvas to regrab area for OCR after clicking to a next page?
I am working on a project where I need to drag and select a particular area on the screen, extract the text from it using OCR, and save the extracted text to a Notepad file. Then, I want to click a ...
0
votes
1
answer
58
views
Tkinter pinch-zoom
I have a program, that draws a canvas that is scrollable and has a gray grid on it. I need to add pinch-zooming to support MacBook touchpad. I would like to add pinch-zooming functional to my canvas.
...
0
votes
1
answer
30
views
How to check for the position of an Tkinter object then delete it [closed]
from tkinter import *
food_cords= []
wind = Tk()
wind.geometry("1600x850")
canvas = Canvas(wind,width = 1600,height=850)
canvaswide = [1600,850]
canvas.pack()
canvas.create_line(0,700,1600,...
0
votes
0
answers
41
views
I'm facing an error when I use tkinter canvas. It is not able to find the image. How to fix it?
entry0_img = PhotoImage(file=f"img_textBox0.png")
print('1')
# ... (the rest of your Tkinter code)
entry0_bg = canvas.create_image(
737.0, 234.0,
image = entry0_img)
It loads the ...
1
vote
0
answers
51
views
Carousel effect with mouse (drag, move and release)
I'm trying to make a carousel of photos using the mouse (drag and stop). I've got the movement, but the photos are not centered in the frame when I release the mouse button.
I think I am close of the ...
0
votes
1
answer
23
views
Automatically Re-Forcing Tkinter Canvas Fullscreen Image on Top (Windows 10, Python)
The goal is to show the image with no border, full screen, and keep its focus no matter what happens on the computer. The program shows an image in our lobby that clients occasionally see, so it is ...
0
votes
1
answer
48
views
Closing main window doesn't stop tkinter app process
I try to implement matplotlib chart into tkinter app and it works but after closing main window (m) the process is still going and cant stop it without closing the console. Why?
import matplotlib....
0
votes
0
answers
50
views
Unable to print the report generated with reportlab in tkinter
I have created a customer sale report with reportlab, the report is being generated successfully and when I press the print button, it is being saved in the pdf format, when the external printer is ...
0
votes
1
answer
51
views
Why is the tkinter canvas being cleared sometimes but not all
In the game that I am trying to make, one of the methods runs but one line of code does not seem to execute.
import tkinter as tk
from tkinter import messagebox as m
import random as r
import math as ...
-1
votes
1
answer
67
views
Tkinter Canvas Objects
In my python program, I have a tkinter canvas with a circle inside and I would like to create smaller circles but they need to be inside the big circle without touching it. Is there an easy way to do ...
0
votes
1
answer
49
views
How to get rid of tkinter frame and canvas border
In the code below, I am trying to remove the border of the canvas or the edge of the frame the canvas is inside on each of the cells, however, I have set bd=0 and borderwidth=0 for the frame and ...
0
votes
1
answer
40
views
Pixel trail/ after image using tkinter Canvas.move()
I'm trying to make the game Alien invaders in Python using tkinter. Whilst trying to make the aliens move across the screen I've found they leave a pixel trail/ after image as below. I used canvas....
1
vote
0
answers
55
views
How can I make the label widget background transparent or remove it completely on python Tkinter
I am new to using Tkinter, and I have been searching for a solution to remove the background color of the label widget for quite some time. Despite my efforts, I haven't been able to find a ...
0
votes
2
answers
67
views
Why are the .tiff greyscale images when uploaded on tkinter canvas getting converted into binary images?
I am working on developing a GUI onto which I upload greyscale .tiff images and do some processing that I require.
But whenever I load a 16-bit greyscale image greyscale image, to the tkinter canvas, ...
0
votes
2
answers
47
views
Tkinter adding X and Y scroll bars to full app
I am trying to add scroll bars in my Tkinter UI and have an interesting problem. I first added the y bar and it works fine. It fills vertically, scrolls the whole window, and even bound the scroll bar ...
1
vote
1
answer
40
views
How to synchronise point-coordinates and PIL affine image transformation on a Tkinter canvas GUI
I am modifying an existing interactive Tkinter image viewer GUI (original code: https://github.com/ImagingSolution/PythonImageViewer) by adding functionality to draw lines over the image, and for ...
0
votes
2
answers
40
views
Tkinter canvas.after skipping all my prior code
I'm trying to learn python but no matter where I look I can't seem to find an answer for this or anyone else having this problem at all, so I'm wondering if I'm just doing something wrong myself as ...
0
votes
1
answer
17
views
I can't get the canvas inside of a toplevel window to be scrolled by the scrollbar
I have followed a tutorial on youtube on how to do a scrollbar in python and it worked for the person but not for me. After copying what he has done and running I got a scrollbar on my screen but it ...
1
vote
1
answer
100
views
Tkinter Canvas wont change its color and scrollbar wont connect to Canvas
I have a class with my Main Window (App) inherited from ttkbootstrap.Window and a Canvas class inherited from ttkbootstrap.Canvas.
Im creating an Object of the Canvas class in my MainWindow class (App)...
0
votes
1
answer
49
views
Python tkinter change Canvas height
How do you change a canvas' height, after a widget has been added to it? I want to limit the height of a canvas, so that I can scroll it.
Here is demo code showing the problem:
import tkinter as tk
...
0
votes
0
answers
44
views
moving different lines across the canvas with mouse in tkinter
i am trying to make a cropping feature in GUI. currently i can allow the user to draw a rectangle and perform a crop of the image on the canvas when the user unreleases the mouse. Once the rectangle ...
0
votes
1
answer
46
views
How do I add a live framecounter to my tkinter window?
I'm doing a project that uses tkinter. The goal is to have some moving object on a screen that react in a certain way to eachother.
Currently I'm trying to add a live frame counter however I don't ...