Overriding Tkinter “X” button control (the button that close the window) [duplicate]

It sounds as if your save window should be modal. If this is a basic save window, why are you reinventing the wheel? Tk has a tkFileDialog for this purpose. If what you want is to override the default behaviour of destroying the window, you can simply do: root.protocol(‘WM_DELETE_WINDOW’, doSomething) # root is your root … Read more

Drag and drop explorer files to tkinter entry widget?

Tk does not have any command to handle that, and Python doesn’t include any extra Tk extension to perform drag & drop inter-applications, therefore you need an extension to perform the operation. Tkdnd (the Tk extension at http://sourceforge.net/projects/tkdnd, not the Tkdnd.py module) works for me. To use it from Python, a wrapper is required. Quickly … Read more

Attempting to resolve blurred tkinter text + scaling on Windows 10 high DPI displays, but concerned my approach is not Pythonic or is unsafe

Simply using from ctypes import windll windll.shcore.SetProcessDpiAwareness(1) and allowing font size adjustment solved my problems on Windows 10. Not sure why no one commented or assisted though. The blurry fonts are a pain, I would expect this thread had a debate and a best solution for this Tkinter nuisance..

Where can I find API documentation for tkinter?

For a definitive guide to all of the options supported by each widget you should consult the tcl/tk documentation. It’s a fairly trivial mental exercise to translate the tcl into python. The only real problems are when the tcl options conflict with python reserved words (such as the -in option for pack and grid)

Why does the calculated width and height in pixel of a string in Tkinter differ between platforms?

You have two problems. Let’s tackle them one at a time 1: the difference between python 2.5 and 2.6 on the same platform with the same font These two versions of python use different versions of tk. On my mac box, 2.5 uses tk version 8.4.19 and 2.6 uses 8.5.7. In version 8.5.2 of tk … Read more

Use asyncio and Tkinter (or another GUI lib) together without freezing the GUI

Trying to run both event loops at the same time is a dubious proposition. However, since root.mainloop simply calls root.update repeatedly, one can simulate mainloop by calling update repeatedly as an asyncio task. Here is a test program that does so. I presume adding asyncio tasks to the tkinter tasks would work. I checked that … Read more

open multiple filenames in tkinter and add the filesnames to a list

askopenfilenames returns a string instead of a list, that problem is still open in the issue tracker, and the best solution so far is to use splitlist: import Tkinter,tkFileDialog root = Tkinter.Tk() filez = tkFileDialog.askopenfilenames(parent=root, title=”Choose a file”) print root.tk.splitlist(filez) Python 3 update: tkFileDialog has been renamed, and now askopenfilenames directly returns a tuple: import … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)