Eli Heuer’s Blog

Tk Calligraphy: Work Log

Tkinter is a cross-platform GUI toolkit and part of the Python Standard Library. It comes pre-installed with Python for MacOS and Windows. If you are using a Debian based version of GNU+Linux like Ubuntu, it can be installed from the terminal:

sudo apt-get install python3-tk

A Tkinter hello world program looks like this:

from Tkinter import *
root = Tk()
helloWorld = Label(root, text="Hello, world!")

Save the above code sample as hello-world.py and from a terminal in the same directory run:

python3 hello-world.py

And just like that, we have a cross-platform desktop application!

Tkinter is simple, fast, and has pleanty of documentation. There are other ways to create cross-platform desktop applications with Python, notably Qt, Kivy and wxWidgets. But all these frameworks add complexity to the project and make it more difficult for other programmers to contribute to. So, I wanted to learn more about Tkinter, and building a simple paint program seemed like a good place to start. I started with refactoring the code from this blog post, and after a bit of work I had the beginings of a Calligraphy application.


The GitHub repo for this project can be found here. My main goal for Tk Calligraphy is to have brushes designed spcifically for Arabic and Hiragana and to have suport for pressure sensitive drawing tablets.

Source Code


Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC_BY-SA 4.0) license.

© 2018