52,666 questions
-3
votes
1
answer
84
views
How to make adding text to an entry box trigger a function [closed]
import tkinter
pkg = tkinter.StringVar()
text_box = tkinter.Entry(root, textvariable=pkg)
text_box.pack()
if pkg != "":
sel = pkg.get()
else:
sel = "none selected"
...
1
vote
2
answers
125
views
display a decimal point in Tkinter entry
I need to create a tkinter Entry widget to enter a dollar amount into. It needs to type the numbers in from right to left, which I know how to do. I need some way to indicate a division between the ...
Best practices
0
votes
4
replies
56
views
Ttk Entry widget's validation option filters ok for interactive text entry, but not for cut/paste - how to fix?
For instance (partial code),
def validate_input(self, P, S):
if '$' in S:
return False
return True
vcmd = (root.register(validate_input), '%P', '%S')
entry = ttk.Entry(root,
...
0
votes
0
answers
96
views
Changing default arrow icon in tkinter Menubar?
I would like to replace the toplevel tk.Menu widget's default cascade entry submenu-arrow (pictured) with a custom arrow image.
As far as I can tell, this miniscule arrow bitmap is the default for the ...
2
votes
2
answers
96
views
How to read the value of a widget's padding option
Here is an example program, which sets two options text and padding for a label.
import tkinter as tk
import tkinter.ttk
root = tk.Tk()
root.geometry("300x200")
label = tk.ttk.Label(root, ...
1
vote
1
answer
69
views
Adjust ttk.Treeview column width to fit its contents and make horizontal scrolling viable
import tkinter as tk
import tkinter.ttk
root = tk.Tk()
root.geometry("400x300")
frame = tk.Frame(root)
frame.pack(fill="both", expand=True)
vertical_scrollbar = tk.Scrollbar(...
2
votes
1
answer
101
views
Button press result not appearing in the frame intended
Project contains 3 files
main.py
from customtkinter import *
import tkinter as tk
from tkinter import ttk
from include.frame_select import FrameSelect
from include.frame_main import FrameMain
window = ...
1
vote
1
answer
107
views
Add mouse wheel scrolling to a frame with both vertical and horizontal scrollbars
import tkinter as tk
root = tk.Tk()
root.geometry("400x300")
outer_frame = tk.Frame(root)
outer_frame.pack(fill="both", expand=True)
vertical_scrollbar = tk.Scrollbar(...
1
vote
1
answer
84
views
How to propagate event handling from parent widget to its children?
import tkinter as tk
root = tk.Tk()
frame_top = tk.Frame(root, bg="lightyellow")
frame_top.pack(fill="both", expand=True)
label_top_1 = tk.Label(frame_top, text="Label",...
Advice
0
votes
3
replies
104
views
Screenshot a specific widget in tkinter
Is there a more accurate way to screenshot like a specific tkinter widget besides just calculating their coordinates, because it sometimes screenshots outside the window itself.
Heres my code:
def ...
1
vote
1
answer
128
views
Tkinter frame placement
I am trying to build a data visualisation app using tkinter that draws a table with a dropdown element in each record. to do this I place labels using grid and one frame. When I attempt to place ...
0
votes
0
answers
110
views
Image won't update despite variables being updated properly
In the following snapshot, the image of the pet is supposed to be in an "Idle" state, but is currently in a "Sad" state, despite the console saying the state is currently in "...
1
vote
0
answers
120
views
How do I display an image using Tkinter Canvas?
I'm left going around in circles as any solutions I could find have not worked for me or the code I'm trying to work with
For the most part, I have been able to get a rectangle to render just fine ...
2
votes
2
answers
111
views
Tkinter Label Class not placing label on window
I am trying to create a class to put tkinter headings onto a window, however for some reason it will not place them.
I have tried to move the .place around and out of the class and it doesn't seem to ...
3
votes
1
answer
132
views
Issues with redirecting output text to a separate window in Python
I am very, very new to programming having just finished a semester-long course on Python. I wanted to take an existing program I had written for my class and redirect all the output text to a separate ...