[Pythonmac-SIG] Better Aqua support for Tkinter apps via Tile extension

Kevin Walzer sw at wordtech-software.com
Thu Nov 25 03:23:32 CET 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi--just wanted to call everyone's attention to this link if you're
using Tkinter:

http://tkinter.unpythonic.net/wiki/UsingTile

This describes how to call the Tk Tile extension from Python. The
relevance of Tile is that it offers improved theming support for Tk
widgets, and it makes a dramatic difference with Aqua. With Tile, Tk
picks up the Aqua "pinstripe" background, adds a native progressbar and
notebook widget, and a few other things. I use Tile in a Tcl application
I'm developing, and it's a godsend. (See http://wiki.tcl.tk/11075,
http://wiki.tcl.tk/12565, and http://wiki.tcl.tk/12786 for more
information and screenshots on how Tile Aqua looks.)

If you have the latest TkAqua Batteries Included distribution, v.
8.4.7(see http://tcltkaqua.sourceforge.net), then you have Tile on your
machine.

Briefly speaking, here's the code to use with Tkinter (adapted from the
Tkinter wiki site):


root = Tk()
root.tk.call('package', 'require', 'tile')
root.tk.call('namespace', 'import', '-force', 'ttk::*')
root.tk.call('tile::setTheme', 'aqua')
v = IntVar()
Radiobutton(root, text="Hello", variable=v, value=1).pack()
Radiobutton(root, text="There", variable=v, value=2).pack()

root.mainloop()

This does indeed work: it creates a little Aqua window with the
"pinstripe" background that is lacking in standard TkAqua windows.

I don't want to overstate the value of Tile. It simply brings TkAqua to
where it should be in terms of native look and feel, so that it's no
longer lagging behind. (Tile will be included in the core Tk
distribution coming next year.) And it's not complete, at least for
Aqua: it doesn't get scrollbars right, so when I'm working in Tcl/Tk, I
use a mix of Tile and standard Tk widgets (esp. scrollbars) to get the
best combination. If you're using PyObjC, wxPython, or even PyQt, you
get better, more sophisticated Aqua support out of the box. But if
you're working with Tkinter, then take a closer look at Tile. You'll see
a pretty big difference in how your applications look.

Kevin


- -- Kevin Walzer, PhD WordTech Software--Open Source Applications and
Packages for OS X http://www.wordtech-software.com
http://www.smallbizmac.com http://www.kevin-walzer.com
mailto:sw at wordtech-software.com
- --
Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
http://www.wordtech-software.com
http://www.smallbizmac.com
http://www.kevin-walzer.com
mailto:sw at wordtech-software.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBpUIkJmdQs+6YVcoRAu4+AJ96xYE3uVzzfcS4+XgBahzJUK2rmwCggr3b
SfYXOZsJ1Y7O28Mve/hgX84=
=tI3V
-----END PGP SIGNATURE-----


More information about the Pythonmac-SIG mailing list