Skip to content

Tag: tkinter

Python equivalent for C#’s generic List

I am creating a simple GUI program to manage priorities. I have successfully managed to add functionality to add an item to the listbox. Now I want to add the item to the something what is known as List<> in C#. Does such a thing exist in Python? For instance, in C#, to add an item to the listview I

Border colours of canvases (tkinter)

I need help with changing the border colour of a canvas in tkinter This is my code: I have tried: Answer You can use highlightbackground option to change color of border highlight ring(which is also a border-like thing, but is separate from the actual border). (correction, thanks to Bryan Oakley’s comme…

How to set a tkinter window to a constant size

I’m programming a little game with tkinter and briefly, I’m stuck. I have a kind od starting menu, in which are two buttons and one label. If I just create the frame everything is fine, it has the size 500×500 pixels I want the background not to change when I create the buttons and the labe, …

Tkinter import filedialog error

I’m trying to use tkinter with python3 to open an image, see here a piece of code : I have installed python3-tk, and I have the demo window when I write in the terminal. I tried several combinations that did not work : gives , gives I tried with _tinker , FileDialog, file_dialog, but I always have &#822…

Tkinter: getting coordinates of a mouse drawn rectangle

Working on the answer of my previous question, I wonder how to get the coordinates of the 4 pixels representing the corners of the rectangle as well as its 2 dimensions ? Answer You can use canvas.bbox(item) to get the coordinates of the bounding box of an item on the canvas. Because your item is a rectangle,…