Posted on

Table of Contents

tcl

Tcl stands for tool command language. It's an interpretted general purpose language. TK is a graphic user interface library built for use with tcl. Python's TKinter is essentially a bunch of tools to build command strings using the tk module to be handed off to a tcl interpreter that is spun up on program start.

TKinter

Every tkinter program starts off by spinning up the tcl interpreter with Tk() and then we can start telling it to render widgets using the geometry manager (grid, pack, etc). However, it won't do anything until we activate the main loop with Tk().mainloop(). We can then quit by calling the destroy method on the root (Tk()).

canvas

the canvas has its own internal environment where each thing drawn to the canvas has its own id and the canvas can identify which element's pixels the cursor is hovering over.

text rendering

tk.font

allows you to load fonts and apply styles lik italic and bold. It has a function to calculate how much space a piece of text will take up in a given display. For whatever reason tk doesnt have builtin support for one text widget with multipl families so you will need to calculate positioning every time you change font.

window tools

ttk sizegrip

this is a widget that enables the user to click and drag it to adjust the size of the parented window.