In a recent python-list thread, a poster described how to use Tile in Tkinter.
From: Jeremy Bowers Date: Wed, 20 Oct 2004 06:18:45 GMT To: email@example.com Subject: Re: Integrate Tile into Tkinter On Tue, 19 Oct 2004 23:09:50 -0400, Kevin Walzer wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Are there any plans to integrate the Tile extension from Tk into > Tkinter? This theming extension allows native look and feel under > Windows XP and OS X, in particular, and adds a lot of theming > flexibility to Tk apps. In fact, it would bring Tkinter pretty much in > line with wxPython in terms of a native "look" on various platforms, > though wx still has a larger set of core widgets. I've seen only a > little discusison about Tile in Python circles, but it's one of the most > important advances going on with Tcl/Tk these days. Anyway, I'm just > curious, as I have some experience with Tcl/Tk and am learning Python. Assuming you've installed Tile such that Tk can find it, try this: -------------- from Tkinter import * root = Tk() root.tk.call('package', 'require', 'tile') root.tk.call('namespace', 'import', '-force', 'ttk::*') root.tk.call('tile::setTheme', 'alt') v = IntVar() Radiobutton(root, text="Hello", variable=v, value=1).pack() Radiobutton(root, text="There", variable=v, value=2).pack() root.mainloop() -------------- By no means is this a good program in any sense of the term; in particular I don't know if the "root.tk.call"s can be written more concisely and the forced import looks dangerous. But at least on my system, that works as expected and at least demonstrates that you can reach tile from Tkinter with no need to wait for someone. (That is *so* going into my Tk programs.)
I (JeffEpler) haven't actually tried this. Can any wiki-contributors confirm that this works?
(KevinWalzer) Yes, it works nicely.
(ChrisNiekel) Could someone elaborate on the "Assume tile is installed such that Tk can find it"?
(KevinWalzer) Tile is a binary extension to Tk. It should be installed somewhere on the standard library search path for Tcl/Tk, which will vary by platform. On Unix it is often /usr/local/lib; on OS X, it is /Library/Frameworks/Tcl. The best way to figure out where this is is to look at where your version of Python finds Tcl/Tk; other Tcl/Tk extensions will likely be in the same library directory.
(KevinWalzer) See TileWrapper for a more comprehensive Tkinter bridge to the Tile package. Screenshots of a simple Tkinter application using TileWrapper can be found at PyLocateTile; for comparison with standard Tkinter widgets, see the screenshots at PyLocate.