What: Tile
Where: http://tktable.sf.net/tile/
Description: Implementation of the Tk theming engine work discussed in Tk Style Support. Currently at version 0.7.6. Among other things it provides native look and feel widgets such as notebook, treeview, separator, checkbox, combobox (ttk::combobox), label, scrollbar entry and progressbar for Windows XP, MacOS-X. It also provides mechanism to easily create or import themes. More concretely, the vernacular goal seems to be the ability to claim that "Tk widgets look fine under Windows", both in widget appearance and widget availability.
JE For me, the main goal is to provide a better way to build widgets. Making things look fine under Windows (and other platforms) is certainly important, and it's what end-users will most appreciate, but that's really a secondary goal.
As of late summer 2005, the plan is that 8.5 will include Tile (see also TIP #248) as Ttk.
Usage:
package require tile tile::setTheme <theme name>
The proc tile::setTheme is a helper proc and will set the theme to the value specified. These are the themes currently available: classic, default, alt, winnative, xpnative, step, aqua (depending on your platform). More info is here: [L1 ]
List the available themes in an app with the command
tile::availableThemes
Query the current theme by getting the value of the variable tile::currentTheme
puts $tile::currentTheme
If you need to now some colors, that are used by a theme, because you need to adjust Tk stuff to fit in, you can use the array tile::theme::<theme name>::colors like e.g.:
parray tile::theme::clam::colors tile::theme::clam::colors(-dark) = #cfcdc8 tile::theme::clam::colors(-darker) = #bab5ab tile::theme::clam::colors(-darkest) = #9e9a91 tile::theme::clam::colors(-disabledfg) = #999999 tile::theme::clam::colors(-frame) = #dcdad5 tile::theme::clam::colors(-lighter) = #eeebe7 tile::theme::clam::colors(-lightest) = #ffffff tile::theme::clam::colors(-selectbg) = #4a6984 tile::theme::clam::colors(-selectfg) = #ffffff
The 'default' theme colors are here (or so I believe):
parray ::tile::colors ::tile::colors(-activebg) = #ececec ::tile::colors(-darker) = #c3c3c3 ::tile::colors(-disabledfg) = #a3a3a3 ::tile::colors(-frame) = #d9d9d9 ::tile::colors(-indicator) = #4a6984 ::tile::colors(-selectbg) = #4a6984 ::tile::colors(-selectfg) = #ffffff
I don't know if this is the official way to query theme colors, but it works!
How do you know, if a theme has changed? If you need to be notified, if the theme changes, because you then need to adjust some stuff in your own widgets, just bind to the virtual event <<ThemeChanged>>. This event will be sent to each widget and you can then react in an appropriate way. Example:
bind .mytoplevel.mywidget <<ThemeChanged>> {do stuff here to adjust}
GTK/KDE look Some of tile themes try to replicate the look of popular GTK/GNOME and QT/KDE themes (like Red Hat Bluecurve). This is not very useful if the end-goal is to integrate seamlessly with the Linux desktop, since the default theme varies for each distribution and the user may have chosen a different theme anyways. I suggest doing the same thing as in Windows XP and using the QT or GTK theming engine hooks to do the drawing. Some links that can be useful :
http://www.freedesktop.org/Software/gtk-qt
http://ajgenius.us/Gnome/Themes/Tutorials/?id=GTKThemes
In any case, at the very least, it may be interesting to get ideas for Tile
George Petasis is working on a Qt theme for Tile using the QT theming engine (TileQt - [L2 ]). Very nice!
Build instructions for Tile on Windows
I run into many issues trying to get Tile compiling on Windows with XP theming support. With help from Pat I managed to get it working. Here are the exact steps and requirements :
Windows XP Pro, no servipacks installed (I run into some DLL dependencies when installing the latest servipacks but that may just be me :)
VC++ 6.0 Tcl 8.4.6 Tk 8.4.6 Tile from CVS Core Platform SDK February 2003 http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
unpack tcl, tk and tile sources in c:\tcl c:\tk c:\tile
Setup environment:
C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat C:\Program Files\Microsoft SDK\setenv.bat (Important to get XP theme support!!) cd c:\tcl\win nmake -f makefile.vc INSTALLDIR=c:\opt\tcl nmake -f makefile.vc INSTALLDIR=c:\opt\tcl install cd c:\tk\win nmake -f makefile.vc INSTALLDIR=c:\opt\tk TCLDIR=C:\tcl nmake -f makefile.vc INSTALLDIR=c:\opt\tk TCLDIR=C:\tcl install cd c:\tile\win nmake -f makefile.vc TCLDIR=C:\tcl TKDIR=C:\tk OPTS=none
Among the people who deserve much gratitude and recognition for Tile's accomplishments are Joe English, Pat Thoyts, Michael Kirkham, George Petasis, Mats Bengtsson, Jeff Hobbs...
A mailing list for discussion of development of Tile appears at http://lists.sourceforge.net/lists/listinfo/tktable-tile-dev
A Treatise on Tile Tile Treatise
Regarding Tile 0.7 - Hi, I tried...
namespace forget tk::* namespace import ttk::*
right after a fresh interpreter start and a "package require tile". But all I get is: can't import command "label": already exists
Would it be better to do:
interp alias {} label {} ttk::label
to enable themes without recoding?
MG The commands (like label) aren't imported from the ::tk:: namespace, but just exist in the global one - which is why your 'forget' didn't remove them. You'd have to overwrite them with the -force option:
namespace import -force ttk::*
MAK Regarding the above, as of 0.7.x, Tile by default doesn't support compatibility options anymore for many widgets, where there are style replacements. You can enable the compatibility options with a compile flag, in which case an interp alias would be better than namespace import. BUT, if you don't enable the compatibility options, then you shouldn't do either. Why? Because you'll break some of Tk's built-in dialogs and such. They'll expect to be calling Tk's own widgets and use some options that aren't supported by Tile's and you'll get errors.
Planning for the future, it would probably be better to go the other way: if Tile isn't available, then do:
interp alias {} ::ttk::label {} ::label
And change all of your code to use ttk::label, removing all of the uses of no-longer-supported options and moving them to the option database. See generic/compat.h for a list.
HP Installing on Ubuntu 5.10
Trick to installing on Ubuntu 5.10 was to change the tcl and tk paths to their tclConfig.sh, and tkConfig.sh:
./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4
RS hacked up this little demo, which shows a notebook, a treeview, a combobox and a progressbar. The combobox lists the available styles; when one is selected, it is immediately applied to all widgets:
package require Tk package require tile pack [ttk::notebook .nb] set t [ttk::treeview .nb.tree -padding 0] $t heading #0 -text Treeview .nb add $t -text Tree set entry1 [$t insert {} end -text "first item"] $t insert $entry1 end -text "a sublevel" $t insert $entry1 end -text "another item" set entry2 [$t insert {} end -text "second item"] set c [ttk::combobox .nb.cb -values [lsort [style theme names]] -textvar style] .nb add $c -text Combobox -sticky nw bind $c <<ComboboxSelected>> {style theme use $style} set p [ttk::progressbar .nb.pb -variable progress -mode indeterminate] .nb add $p -text Progress -sticky new set progress 0 proc every {ms body} {eval $body; after $ms [info level 0]} every 100 {incr ::progress} .nb select $t bind . <Escape> {exec wish $argv0 &; exit}
On TkAqua, TLabel's automatically dim their text when they're not foremost (through $widg state background). How can I disable this for one specific widget (which I always want to have easily readable, even if not foremost)?
JE In current CVS (9 Jul 2006), explicitly setting $label configure -foreground black will take precedence over the state-specific theme settings. See also SF bug #1517110.
PWQ 27 Mar 06, You are not allowed. You want native look and feel don't you?, stop bleating because thats what you have got.
MG May 15 2006 - Does anyone know if there's full documentation available for Tile? I just started playing around with the Notebook widget but, aside from RS's demonstration above and the error messages from using the commands incorrectly, I couldn't find any docs.
Answer: http://tktable.sourceforge.net/tile/doc/notebook.html (MG Thanks!)
Also, it looks like when there isn't enough room for all the tabs in a Notebook widget to be displayed, they're all shrunk to fit. Is this configurable? I'm trying to do an app which will likely have a lot of tabs with long names open at once, so them being in a scrollable frame or something like that would be handy, if possible. Thanks for your help. :)
sbron July 19 2006 - In a tile application on the Mac a toplevel should be pinstriped, but there is no ttk::toplevel command. So I came up with the following proc to easily convert an existing application that will look right, even on the Mac. This is probably obvious to all the widget wizards but it took me some time to find this solution, so I thought it may be useful for others too.
proc ttk::toplevel {w args} { eval [linsert $args 0 ::toplevel $w] place [ttk::frame $w.tilebg] -x 0 -y 0 -relwidth 1 -relheight 1 set w }
[ Category Package based on Tk | Category GUI ]