Thank you, Tkinter. (easy to use)

argo785 at argo785 at
Thu Feb 12 00:06:06 EST 2009

Tonight I needed to draw a series of simple shapes in a window using a
bit of math but didn't have much time to do it. I've got very little
GUI toolkit experience. Briefly had a look at the usually-recommended
heavyweight GUI toolkits, but I didn't want to inherit from widget
classes or override paint methods (not that those things don't have
their place). I just wanted to quickly draw some shapes. Within a few
minutes I had what I needed, and it was by using Tkinter. The code
looked something like this:

#!/usr/bin/env python

import Tkinter as tk

root = tk.Tk()

canv = tk.Canvas(root, width=647, height=400, background='white')
canv.pack(side=tk.TOP, fill=tk.BOTH, expand=1)

# drawing happens here ...
canv.create_oval(50, 80, 150, 180)
# ...


Wow that was *really* easy.

After playing around just a bit more, regular GUI programs are pretty
quick and simple to make as well. My only (minor) complaint is that Tk
doesn't draw text antialiased in the various widgets (menus, labels,
buttons, etc.).

Anyway, thanks Tk and Tkinter!

More information about the Python-list mailing list