52,703 questions
0
votes
1
answer
109
views
Child widgets not shown correctly if parent Frame is gridded later
I have an application that divides the main window in two:
Left: a canvas, where a map will be displayed
Right: a frame, where several other frames will share space and one of them will be shown ...
Tooling
0
votes
4
replies
112
views
Is there a tkinter editor suitable for beginners
I am a newbie in Python. My assignment requires me to use a graphical interface, and I plan to use tkinter for this purpose. However, I find manually typing code too complicated. Could any expert ...
-1
votes
0
answers
88
views
Tkinter UI not properly displaying on MacBook [closed]
I'm working on a Mac using Homebrew to manage Python versions with pyenv.
When I run the app, it displays a mostly gray screen; the buttons in the UI still display and function. Additionally, when ...
0
votes
1
answer
111
views
How to destroy Tkinter windows from external script?
I have a script called GUI running two tkinter windows and I've been able to kill my program from within the script by creating a function for it
def gui_kill():
root.destroy()
win.destroy()
...
2
votes
1
answer
72
views
dateentry Tkcalendar change the month and year repeatedly?
I'm using DateEntry from tkcalendar. The problem is that I can only change the month and year the first time. When I try to change the year or month a second time, the calendar immediately disappears. ...
2
votes
1
answer
79
views
Cannot get an IntVar object from one tkinter script called by a function to the script which calls it
I'm trying to have an IntVar object move from one script to another via a function that calls the second script when the toplevel window created in the second script is destroyed
main script:
from ...
2
votes
1
answer
91
views
Tkinter window shows “Not Responding” while running my text-to-speech code (how do I prevent the GUI from freezing?)
I’m making a GUI application in Python using Tkinter that reads text out loud from PDF, DOCX, TXT, and images using gTTS.
The program works, but sometimes Tkinter window becomes unresponsive and shows ...
0
votes
1
answer
102
views
Image replacing/deleting other image in tkinter
When I have 2 images loaded in tkinter even though they are in a different position, only one of them shows up so I assume that one of them is deleting/replacing each other. how do i fix it?
import ...
0
votes
0
answers
67
views
How to fix Tkinter program shrinking when using MSS library to screenshot
Whenever I'm using mss I'm trying to take a screenshot of part of my program in which I would create an array of x and y values of nodes and find the minimum and maximums of those x, y values then ...
1
vote
2
answers
131
views
How can I make a square Tkinter Entry widget if width only accepts integers?
I'm trying to create a square tk.Entry widget in Tkinter, but the width parameter only accepts integers which represent a number of characters instead of pixels.
Setting width=2 makes the box too ...
-2
votes
1
answer
96
views
Placing text box next to text in tkinter
I'm attempting to learn tkinter, how can i edit this code so that the text box is directly next to the input statement ? I've tried putting the text box in the first column with an alignment to the ...
1
vote
0
answers
65
views
Python Customtkinter: Getting real widget size
I seem to be always getting 120 for both height and width, I don't know why it refuses to give me the real value for the width so I can make the maintain the height in a 16:9 ratio
# Monitor frame
...
0
votes
1
answer
48
views
Tkinter image will not change [duplicate]
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
def change():
img2 = tk.PhotoImage(file = "img2.png")
label.configure(image = img2)
img1 = tk.PhotoImage(file = "...
0
votes
1
answer
108
views
Tkinter ttk.button background is leaking color outside the button border
Button is created like:
style.configure('Dark.TButton', background=button_base, foreground=colors['text'], borderwidth=1,
bordercolor=edge, lightcolor=edge, darkcolor=edge, padding=...
1
vote
3
answers
76
views
How can I update a text name on a label on Tkinter:
I want that when I upload a file, the label changes its name to file name to filename name.
#File class
class File:
def __init__(self):
self.filename = None
def getFile(self):
...
Best practices
2
votes
1
replies
35
views
How can I save a local file using tkinter with filedialog.askopenfilename
How can I treat a file when the client imports a local file as a variable and using it later?
def getFile():
return filedialog.askopenfilename()
from operation.encryption import getFile
...
Best practices
0
votes
2
replies
75
views
Trying to make it CTk, but STATE not working
I have this script in Tk and it works fine. I wanted to make it dark and add hover options, so I changed it to CTk, but now it's not working. Can someone please help me fix this? I have both scripts ...
0
votes
1
answer
63
views
How can I put the label in the frame on the left side on Tkinter? [duplicate]
I want to put the "Selecto a file to encrypt" on the left site, a try it separate too and it didn't work.
tk.Label(frame, text="Select a file to encrypt: ", fg="black")....
0
votes
3
answers
66
views
How can I put the Label into the frame?
I'm new into tkinter and I don't know how to put this Label:
tk.Label(frame, text="Select a file to encrypt: ", fg="black").pack()
Into that frame:
frame = tk.Frame(root, width=...
0
votes
1
answer
61
views
Tkinter grid propagation and scrolling
I have a tkinter window that runs script, with this general layout:
┌─────────────────────────────────────┐
│ Op Buttons │ ← Row 0 (fixed)
├───────────────────────────────────...
0
votes
0
answers
101
views
Why won't the file dialog open when I use withdraw() early in the program?
Quick edit for anyone in the future who sees this post: I KNOW the common way you're supposed to be importing modules in in the top of the script, outside of any methods. But the class I'm in for some ...
-1
votes
0
answers
51
views
My toplevel window shuts down entire app on toplevel.destroy
This happens after selecting a date from the DateEntry popup. If you type a date into the DateEntry widget the exit routine shuts the toplevel correctly. Select a date from the popup and the exit ...
0
votes
2
answers
82
views
Horizontal and vertical scrollbars using TKinter and Python almost working
I wanted to try to use tkinter for the first time, and had a little program I wanted to try.
It needed some text in a "table" and because of the number of rows and columns, I needed ...
0
votes
0
answers
71
views
Why does the Tkinter canvas-enter event behave differently in Windows 11 and Linux Mint?
I bind the enter-event to a Tkinter canvas widget. But it seems that Tkinter on Windows 11 and Tkinter on Linux Mint handle the event differently. In my example the enter-event is bound to the green ...
1
vote
1
answer
82
views
Alt, Shift and Control key bindings in Tkinter
I am struggling with some key bindings in Tkinter.
In my application, to avoid having to make each widget get the focus prior to having the opportunity of capturing KeyPress events, I decided to use ...
0
votes
1
answer
74
views
Tkinter not display window; declared as part of class
Running VSCode with MS Python extension and my window will not display
here's my code
import tkinter as tk
class FormMain:
def __init_(self):
self.build_controls()
def build_controls(...
1
vote
0
answers
44
views
Removing the box surrounding the down arrow of a ttkinter.ComboBox
I want to remove the box surrounding the arrow of a combobox, seen below
I am using ttkinter with the theme "Clam", and styling it like this:
combobox_style = ttk.Style()
...
1
vote
3
answers
115
views
Force a widget to be a square
I am using Python 3.14 on Windows 11.
I have 2 frames (left and right) inside a top Frame, and there is also a bottom Frame that will act as a status bar.
I want the left frame to be a square, giving ...
0
votes
0
answers
38
views
Pytubefix seems to only partially work, on_progress_callback does not run
from tkinter import *
from tkinter import filedialog
from tkinter.ttk import Progressbar
import pytubefix.exceptions
from pytubefix import YouTube
import time
def openFile():
global filepath
...
2
votes
0
answers
57
views
Tkinter messageboxes opened from a pystray menu appear unfocused or behind other windows on Windows 11
I'm building a Python desktop app that uses both pystray (for a system tray icon) and Tkinter (for message boxes and dialogs). Everything works fine except for one issue on Windows 11: when I open a ...
0
votes
1
answer
33
views
ttkbootstrap Messagebox does not display message under linux Mint but ok in windows
The Messagebox shows up as it does under windows - but only shows the title not the message.
I have created a simple piece of code to illustrate the problem:
from tkinter import *
import ttkbootstrap ...
1
vote
1
answer
137
views
Tkinter window shrinks after embedding Matplotlib canvas — how to prevent it?
I'm building a multi-frame Tkinter app for a school project (NEA dashboard). One of the frames displays a Matplotlib scatter plot using FigureCanvasTkAgg. The issue is that after switching to the ...
0
votes
1
answer
140
views
I cannot set tkinter frame width
I want to have fixed width frames with tkinter.
The main idea is to have a dynamic number of fixed width columns (in this example 2) and within each columns a dynamic number of entries (in this case a ...
1
vote
2
answers
106
views
Buttons in tkinter are not visible
import tkinter,time
canvas=tkinter.Canvas(width=500,height=500,bg="white")
canvas.pack()
canvas.create_text(250,250,text="0:0:0",font="Arial 70 bold")
global b
def ...
2
votes
2
answers
89
views
How to catch Tkinter text widget state/data before it is destroyed?
I'm trying to catch/save the text widget state (for use later) before it is destroyed by binding it to the <Destroy> event, for example:
import tkinter as tk
root = tk.Tk()
text = tk.Text()
text....
0
votes
2
answers
102
views
How to stop this game for seconds and start from where it was stopped?
I wrote a game with python tkinter but i don't know def stop??
I want to stop the game for seconds and then start again from where it was stopped.
I want to press SPACE key and then the game stops and ...
0
votes
1
answer
106
views
Why do all my declared windows open when I start in my tkinter application? [closed]
I am working with tkinter and I want to use three windows:
startWindow
addWindow
deleteWindow
I want to start them separately, but when I run my code, all three windows start immediately.
How can I ...
0
votes
1
answer
135
views
Horizontal scrollbar on tkinter treeview is not working
I am using tkinter, pandas and treeview.
The treeview is to display an excel file via filedialog with 15 columns, which is very lengthy, hence I needed a horizontal scrollbar.
However the scrollbar ...
2
votes
2
answers
101
views
Python Tkinter Labelframe strange behaviour
My program gets a list of messages and displays them on a Tkinter widget.
"Previous" and "Next" buttons let me read through the message list.
I can read all the messages and ...
1
vote
2
answers
121
views
Tkinter loading user Data from a file not in directory
I want to make a Tkinter program where separate users can load their data, (a dictionary) from a sub-folder within the main project directory.
My_project
|_main.py
|
|_User_data
|
|_ Data.py
...
0
votes
1
answer
91
views
Why is the order of my tkinter windows changed, when the "last" window executes another tkinter program by popen?
I have an tkinter application with several windows, which often are placed over each other in a window stack, so that only a topmost window is visible. In this topmost window I can press a button ...
2
votes
1
answer
80
views
Tkinter call another window with a button
Good evening,
I would like to build a tkinter interface with several buttons leading to differents script. Those script are functions in another folder.
In the example I built to explain my problem, ...
1
vote
2
answers
113
views
How to make sure a user can't submit an entry if it has the same ID number? [closed]
I'm trying to make a Student Information System, the information will be stored in a text file, and will be shown through a table.
Submit button function:
def submit():
if idEntry.get() == "&...
3
votes
1
answer
106
views
Tkinter Load data from another directory
In Tkinter want to import variables stored on a file in a sub directory of the main project but am having trouble. I can read the file, but cannot import variables. Please Help.
def change_dir():
...
0
votes
0
answers
55
views
Tkinter: treeview inner lines' styling
I managed to style a treeview control to this nice gridview:
container = tk.Frame(self, relief='sunken', borderwidth=1, bg='white')
container.grid(column=0, row=0, sticky='nsew')
container....
5
votes
1
answer
75
views
How can I set 25-25-50 ratio between grid children?
In tkinter I wish to achieve the above goal.
I can perfectly get 50-50, and 25-25-25-25. But tried everything to get 25-25-50 without success:
import tkinter as tk
root = tk.Tk()
root.geometry("...
2
votes
2
answers
130
views
How to sort 1 list over 2 frames
Is it possible to sort 0:5 to frame 1, and sort 5:10 to frame 2 using one list?
Now it is clicking both radiobuttons in frame 1 and 2. I would like that only one can be selected at the time.
My code:
...
1
vote
1
answer
83
views
expected integer but got "none"
I have two lists, but I want them to work as one. So only one radiobutton can be activated at the time. I am trying to get them to print something without an error, but I keep getting an error because ...
9
votes
1
answer
411
views
List isn't expanding
These lists aren't expanding, only the last thing on the list is visible. My list works when I use it as pack. But I want to have 3 lists right next to each other with radiobuttons using grid. But I ...
1
vote
1
answer
54
views
I'm having trouble adding items to a combobox with a textbox and pushboton in GUIzero
I'm trying to add items to the combobox in GUIzero getting the value from a textbox when a button is pressed, but when the button is pressed I get the following error:
Exception in Tkinter callback
...