How do I compile my Python 3 app to an .exe?

cx_Freeze does this but creates a folder with lots of dependencies. py2exe now does this and, with the –bundle-files 0 option, creates just one EXE, which is probably the best solution to your question. UPDATE: After encountering third-party modules that py2exe had trouble “finding”, I’ve moved to pyinstaller as kotlet schabowy suggests below. Both have ample documentation … Read more

Strange Exception in Tkinter callback

mtTkinter allows multithreading with Tkinter, you can get it here: http://tkinter.unpythonic.net/wiki/mtTkinter Just import mtTkinter in place of Tkinter. This will allow you to insert text into a Text widget from multiple threads without conflict. I used it for some instant messaging software I wrote and it works wonderfully.

Tkinter error: Couldn’t recognize data in image file

Your code seems right, this is running for me on Windows 7 (Python 3.6): resulting in this tkinter GUI:  with this image as bll.jpg:  (imgur converted it to bll.png but this is working for me as well.) More options: This answer mentions, tkinter is working only with gif images. Try using a .gif image. If this is not working, use PIL as stated in this answer. … Read more

How to handle a Button click event

I’m just learning Python and I have the base concept down, and already a few command line programs. I’m now learning how to create GUIs with Tkinter. I created a simple GUI to accept some user information from a Entry widget, and then, when the user clicks submit, it should pop up a dialog. The … Read more

How to clear Tkinter Canvas?

Every canvas item is an object that Tkinter keeps track of. If you are clearing the screen by just drawing a black rectangle, then you effectively have created a memory leak — eventually your program will crash due to the millions of items that have been drawn. To clear a canvas, use the delete method. … Read more

Disable / Enable Button in TKinter

A Tkinter Button has three states : active, normal, disabled. You set the state option to disabled to gray out the button and make it unresponsive. It has the value active when the mouse is over it and the default is normal. Using this you can check for the state of the button and take … Read more

Difference between import tkinter as tk and from tkinter import

from Tkinter import * imports every exposed object in Tkinter into your current namespace. import Tkinter imports the “namespace” Tkinter in your namespace and import Tkinter as tk does the same, but “renames” it locally to ‘tk’ to save you typing let’s say we have a module foo, containing the classes A, B, and C. Then import foo gives you access to … Read more