Relative Content

Tag Archive for pythonuser-interfacetkinter

Tkinter: how to calculate the size of a widget

At the moment I’m planning to write a Minesweeper game in Python using Tkinter.
I’m trying to find an elegant way to determine the height of the playfield buttons based on the font used on these buttons. Then I can set the colum widths of the grid to that value to get square buttons.
This is an abridged version of the code I’ve got so far:

Tkinter Check Combo Box Issue

I am trying to create a combo box with a checkbox against each item. I am not able to select multiple items at one go as every time I have to click the drop-down and select one. Also, It collapses every time I select one item.

Tkinter Error when using ‘.grid’ (Code is unfinished)

Traceback (most recent call last):
File “/Users/kalybarly/.py”, line 22, in
arial.grid(row=0, column=0, sticky=tk.W+tk.E)
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tkinter/init.py”, line 2522, in grid_configure
self.tk.call(
_tkinter.TclError: cannot use geometry manager grid inside . which already has slaves managed by pack

Tkinter just cuts off text boxes and adds automatic line break

In tkinter, I have a textbox which is almost the size of the entire screen. The problem is that when I keep typing in the textbox, it automatically cuts off and moves onto the next line. Is there a way to add a scrollbar on the bottom in order to prevent this? Thanks in advance.

image “pyimage13” doesn’t exist?

im trying to load an image into the background of a tkinter gui but everything i try seems to not work and I always get the error:
TclError: image “pyimage13” doesn’t exist

Python Tkinter expressions not showing on second GUI screen

I have 2 different .py files, one has the the main Tkinter GUI window and other has a code to run calculator in tkinter GUI, the calculator file when executed alone works fine but when called inside the main Window, no expresion is shown on the main GUI just the buttons .