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.

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.

The canvas is a general purpose widget, which is typically used to display and edit graphs and other drawings.

Another common use for this widget is to implement various kinds of custom widgets. For example, you can use a canvas as a completion bar, by drawing and updating a rectangle on the canvas.

The Canvas is the only scrollable widget in Tkinter. This is useful for more complicated GUIs where there may not be enough space for all the widgets.

Source

1963 questions
8
votes
1 answer

matplotlib's zoom functionality inside a tkinter canvas

I have been trying to transfer some scripts behind a GUI (using Tkinter) and so far have made it thus far that any data that is opened is shown in a Tkinter canvas (using matplotlib to draw it). The only problem that I have with this is that the…
Bas Jansen
  • 3,273
  • 5
  • 30
  • 66
7
votes
1 answer

Using tkinter -- How to clear FigureCanvasTkAgg object if exists or similar?

Trying to create a tkinter based window that allows user to create a chart on button click, refreshing the chart -- not adding another, each time. All without creating a new window. The idea is click -> create chart, click again -> replace the…
Blaine Kelley
  • 85
  • 1
  • 6
7
votes
2 answers

How to hide and show canvas items on tkinter?

I know that pack and pack_forget can be used to show or hide widgets. Which are the equivalent commands for items on a canvas? Notice: It would be better to keep the complete item information, including its position. This is not the case with…
bmello
  • 1,864
  • 3
  • 18
  • 23
7
votes
1 answer

Capability to delete all items with certain object tag tkinter

I have a few different object tags within a tkinter canvas. I would like the user to be able to delete the current object under the mouse cursor with the tag "token". I do not want all objects with the tag "token" to be deleted, only the one under…
user1332577
  • 362
  • 5
  • 17
7
votes
4 answers

Increase tkSimpleDialog window size

How do i increase or define window size of tkSimpleDialog box ? import Tkinter, tkSimpleDialog root = Tkinter.Tk() root.withdraw() test = tkSimpleDialog.askstring("testing", "Enter your search string text") print test
Shekhar Samanta
  • 875
  • 2
  • 12
  • 25
6
votes
1 answer

Matplotlib rcParams ignored when plotting

I am working on an interactive plotting script using matplotlib version 3.2.2 and tkinter. When the script is run, the first window looks like this: Furthermore, the rcParams are updated and plotted once the Plot figure button is clicked: If I now…
meerkat
  • 932
  • 2
  • 14
  • 38
6
votes
1 answer

How to change the background color of a tkinter Canvas after it is created?

I know that canvas = tkinter.Canvas(bg='red') creates a canvas with the background color of red. Since the background color is chosen when creating a new canvas, is there any way to change this later on in the program without creating a new…
Connor
  • 272
  • 1
  • 2
  • 10
6
votes
2 answers

Why does this shape in Tkinter update slowly?

Attempted to do simple movement in tkinter: import tkinter as tk class GameApp(object): """ An object for the game window. Attributes: master: Main window tied to the application canvas: The canvas of this window …
Dova
  • 310
  • 3
  • 19
6
votes
2 answers

tkinter put scrollbar on canvas at bottom position

Question on scrollbar positions on my tkinter canvas. I have a frame with 3 canvas widgets. Courtesy to this post for the idea. I added a horizontal scrollbar and each canvas has a 50+ column 500+ row pandas dataframe. The load is not very fast but…
6
votes
1 answer

TKinter Canvas 'dash' option is not behaving as expected

canvas.create_line(50, 500, 950, 500, dash=(5, 1), tags="splitDistance") This will create a line which looks like this: XXXXX XXXXX XXXXX XXXXX 5 dashes, 1 space and then repeat, as told by this documentation But when changing the 1 to any value,…
Blightbuster
  • 481
  • 7
  • 16
6
votes
1 answer

MatplotLib get all annotation by axes

i'm doing a project with Python and Tkinter. I can plot an array of data and i also implemented a function to add annotation on plot when i click with the mouse, but now i need a list of all annotation that i added. Is there any way to have…
Davide Ruzza
  • 631
  • 2
  • 7
  • 8
6
votes
2 answers

How do you delete a Canvas text object?

This is for example a create_text: self.__canvas.create_text(350, lineVotes, text=str(likesPrinted), font=("calibri", 30), fill="#66FF99", anchor=E) How could I delete this with a button?
user4351838
6
votes
1 answer

Tkinter - Inserting text into canvas windows

I have a Tkinter canvas populated with text and canvas windows, or widgets, created using the create_text and create_window methods. The widgets I place on the canvas are text widgets, and I want to insert text into them after they are created and…
Yngve
  • 743
  • 4
  • 10
  • 15
5
votes
2 answers

Display an image with transparency and no background or window in Python

I'm trying to display an image on the screen, without any window/application popping up/containing it. I'm pretty close with TKinter, but the method for removing the background color of the canvas is hacky and has some undesired effects. import…
John
  • 91
  • 1
  • 5
5
votes
2 answers

tkinter - Why is there such a thing like bbox?

Now that I'm working more with tkinter Canvas I was wondering about the use of bbox. For me I'm using bbox to get the coords of an element but the Canvas already have a method to return the coords of an item. So why did they invent something like…
Thingamabobs
  • 7,274
  • 5
  • 21
  • 54