'''What:''' Tile '''Where:''' http://tktable.sf.net/tile/ '''Description:''' Implementation of the [Tk] theming engine work discussed in [Tk Style Support]. Currently at about version 0.7.8. Among other things it provides native look and feel [widget]s such as: * button * checkbutton * [checkbox], * [combobox] ([ttk::combobox]), * dialog * entry * frame * image * [label], * labelframe * menubutton * [notebook], * panedwindow * [progressbar] * radiobutton * [scrollbar] , * [separator], * sizegrip * [treeview], for [Windows] XP, [MacOS]-X. [[Notice that Tile also supplies a [style] command.]] 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 October 2006, Tk 8.5 will include Tile (see also [TIP] #248) as [Ttk]. The Tk version 8.5a6 (alpha version 6) already includes Tile in the ttk namespace. [DKF], 15 Jan 2007: See below for five screenshots of the ''same'' process with many widgets and different themes. This was prepared with [http://www.cs.man.ac.uk/~fellowsd/tcl/themes.png] The themes, from left to right, are: '''classic''', '''clam''', '''alt''', '''xpnative''' (the default on my system), and '''winnative'''. Note that the only thing that changes between them is the theme; nothing else at all changed. ---- [LV] The move from Tile to [Ttk] has begun. But what puzzles me is that, even though the code appears to have been integrated into the [Tk] 8.5 source line, the Tile source code still is getting updated. So does this mean that someone is going to have to spend several months porting Tile changes into Tk 8.5? [JE] Yes. Tile will be maintained as an 8.4-compatible extension for as long as Tcl/Tk 8.4 remains a viable platform. It will take a while before everyone can upgrade to 8.5. ---- '''Usage:''' The following instructions are for the Tile ''package'', not for the ttk included in Tk 8.5. There are subtle differences, such as tile::setTheme becoming ttk::setTheme and others. package require tile tile::setTheme 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: [http://www.t-ide.com/tcl2005e/2_tile-eurotcl2005.pdf.gz] 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 know 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::::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 <>. This event will be sent to each widget and you can then react in an appropriate way. Example: bind .mytoplevel.mywidget <> {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 - [http://www.ellogon.org/petasis/index.php?option=com_content&task=view&id=24&Itemid=40]). 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 ---- '''Build instructions for Tile on MacOS X''' ... see for example [Tile and BLT together on MacOS X] ---- 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 ---- [The difference Tile makes] ---- A Treatise on Tile [Tile Treatise] ---- [Applications using Tile] [How to migrate to Tile] ---- '''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: [WikiDbImage tiledemo.jpg] [WikiDbImage tiledemo2.jpg] AW: Note that these screenshots are from a Windows CE machine. 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 <> {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 . {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 } [WK] If someone just wants to make an additional tile style for an image based button, here's a small snap-in to do it: style default TButton -relief flat style element create TButton2.button image img0 -map [list disabled img1 pressed img3 active img2] style layout TButton2 { TButton2.button -children { Button.label } } ttk::button .button -command {puts Test} -style TButton2 (it assumes img0, img1, img2 and img3 are valid Tk images) ---- Important: "Writing new widgets with Tile" [http://tktable.sourceforge.net/tile/WidgetGuide.html] Mildly journalistic: "Tile makes Tcl look good" [http://www.unixreview.com/documents/s=10102/ur0610j/] ---- MSH November 23 2006: I have a question about style setting in the notebook, I have an application which currently uses a BWidget Notebook to display pages. I modify the font style and color to indicate the current state of the page (ie italic or red text indicates a certain state), As BWidget works badly with Tile, I would like to know how to change the style for individual tabs ? or even set the state of a tab to readonly and use the style map TNotebook.Tab ! One last point BWidget adds scroll buttons to the tabs when there is not enough space, other systems allow multiple rows of tabs, will the notebook have one of these functions added, as its current action (squash them up while I can) is not at all practical. ---- [[ [Category Package] based on [Tk] | [Category GUI] ]]