tcl

Is tkwait wait_variable/wait_window/wait_visibility broken?

Is tkwait wait_variable/wait_window/wait_visibility broken? Question: I recently started to use tkwait casually and noticed that some functionality only works under special conditions. For example: import tkinter as tk def w(seconds): dummy = tk.Toplevel(root) dummy.title(seconds) dummy.after(seconds*1000, lambda x=dummy: x.destroy()) dummy.wait_window(dummy) print(seconds) root = tk.Tk() for i in [5,2,10]: w(i) root.mainloop() The code above works just fine …

Total answers: 1

How to handle a WM_ENDSESSION in tkinter?

How to handle a WM_ENDSESSION in tkinter? Question: I’m having trouble figuring out how to receive the WM_ENDSESSION window manager message in Tkinter, that is supposed to be sent to the top-level window during system shutdown. I am aware of everything that comes with trying to run extra code during shutdown, however in my case …

Total answers: 4

Exhaustive documentaion for tkinter filedialog.askdirectory

Exhaustive documentaion for tkinter filedialog.askdirectory Question: I am using tkinter filedialogue.askdirectory() and want to know what options I can enter in. The python documentation just has **options with no description of what options are valid. In general, I have found tkdocs useful but, for filedialogue they don’t mention any options. Something like Java’s javadocs are …

Total answers: 1

local machine _tkinter.TclError: couldn't connect to display ":0"

local machine _tkinter.TclError: couldn't connect to display ":0" Question: TLTR: Getting the following error while trying to display tkinter app on my local laptop (running Pop_OS!) _tkinter.TclError: couldn’t connect to display ":0" Hello world, First off: Im new to posting questions here so bear with me. If something about my questioning isn’t right please tell …

Total answers: 1

Python embeddable zip: install Tkinter

Python embeddable zip: install Tkinter Question: Python embeddable zip comes without pip and Tkinter. It is easy to install pip with get-pip.py in the embeddable zip. How can we install Tkinter too (assuming we do not have an existing Python installation in the same machine)? Asked By: antonio || Source Answers: Assuming you are on …

Total answers: 3

List of All Tkinter Events

List of All Tkinter Events Question: In Python tkinter module, <Button-1>, <Button-2> and <Button-3> are used to identify mouse button clicks for left, middle and right buttons respectively. Likewise, <KeyPress-Return> is used for the return key press. Where can I find a list of all such events, including the names for the various keyboard keys? …

Total answers: 3

How to Call TCL Procedure using Python

How to Call TCL Procedure using Python Question: Using below code i can able to call all procedure in the Proc.tcl file ,but i want to call individually the procs like sum or sub ,Please let me know any other possibility to call it My proc file program, puts “hello” proc sum {a b} { …

Total answers: 7

How to set border color of certain Tkinter widgets?

How to set border color of certain Tkinter widgets? Question: I’m trying to change the background color of my Tkinter app, but for certain widgets it leaves a white border around the edges. For example, this: from tkinter import * COLOR = “black” root = Tk() root.config(bg=COLOR) button = Button(text=”button”, bg=COLOR) button.pack(padx=5, pady=5) entry = …

Total answers: 2