When to use Variable classes? (BooleanVar, DoubleVar, IntVar, StringVar)

In a tkinter application, StringVar (as well as IntVar, BooleanVar, and DoubleVar) are very rarely needed. The underlying tcl/tk interpreter provides special features for all of its variables, so these wrappers exist to take advantage of those features. The two big advantages that these variables have are: You can associate one variable with more than … Read more

Tkinter error: Couldn’t recognize data in image file

Your code seems right, this is running for me on Windows 7 (Python 3.6): from tkinter import * root = Tk() canv = Canvas(root, width=80, height=80, bg=’white’) canv.grid(row=2, column=3) img = PhotoImage(file=”bll.jpg”) canv.create_image(20,20, anchor=NW, image=img) mainloop() resulting in this tkinter GUI: with this image as bll.jpg: (imgur converted it to bll.png but this is working … Read more

Tkinter – Geometry management

Basic knowlege about tkinters geometry management The geometry management of tkinter is characterized by this Quote here: By default a top-level window appears on the screen in its natural size, which is the one determined internally by its widgets and geometry managers. Toplevels Your Toplevel is the first question you should have to answer with: … Read more

Removing the TK icon on a Tkinter window

On Windows Step One: Create a transparent icon using either an icon editor, or a site like rw-designer. Save it as transparent.ico. Step Two: from tkinter import * tk = Tk() tk.iconbitmap(default=”transparent.ico”) lab = Label(tk, text=”Window with transparent icon.”) lab.pack() tk.mainloop() On Unix Something similar, but using an xbm icon.