Updated 2010-11-23 16:46:46 by AMG

SS 15Mar2004: In a tclcore ML thread about a better default Tk look&feel for Unix systems, Jeff Hobbs sent an interesting file with a style for Tk (see http://aspn.activestate.com/ASPN/Mail/Message/Tcl-core/2022026). Since Jeff states in the email that the code can be considered Tcl-licensed, it may be more comfortable for potential users to put it in some accessible place. For now you can download it from this link:

http://tcllib.sourceforge.net/TkLook/as_style.tcl.txt

PT 15-Mar-2004: You can compare screenshots of tkchat with this style and a gtklook.tcl style here [1]. I have committed a new version of tkchat that will try and use the as::style package if it can find it. The user can set a preference via then Preferences->Options dialog that will be used on the next re-start.

LES: is there any programmatic advantage in either? They look pretty much the same to me.

davidw I have taken the x11 specific bits of this, relevant to TIP 172, and packaged them up in the style module, in tklib, along with what was formerly known as gtklook, and is now called 'lobster'. This code is available, along with the "lobster" style, at

http://dedasys.com/freesoftware/files/style.tgz

Anyone have examples on how to use this code?

For instance, recently Jeff mentioned this code fragment, added before any Tk widgets are created, allows one to add the ability to increase or decrease the fonts used in widgets by making use of control + / control - / or control - MouseWheel.
 package require Tk
 package require style
 style::use as
 style::as::enable control-mousewheel global

 # now go about creating widgets

This would work for standard widgets which don't make use of the -font flag.

[jal_frezie] - 2010-11-23 11:19:15

Found a little problem -- the mousewheel then scrolls canvas widgets that are not supposed to scroll! Made this little fix to as.tcl to stop that happening, it prevents scrolling if the whole canvas is already visible.
457,458c457,459
<             while {[catch {$w $view scroll $delta units}]
<                    && [winfo toplevel $w] ne $w} {
---
>             while {[catch {if {[$w $view] ne {0.0 1.0}} {
>                 $w $view scroll $delta units}}]
>                 && [winfo toplevel $w] ne $w} {