2007-12-26 HE This days I tried tcl/tk 8.5 the first time. Here my experiences with 8.5.0 on Windows XP with eTcl.
:-) nice, good, I like it; :-| neutral; :-( not so good, I don't like it, makes additional work:
checkbutton .c1 -variable c1 -onvalue a -offvalue b -tristatevalue c checkbutton .c2 -variable c2 -onvalue a -offvalue b pack .c1 .c2 -side left set c1 a ;# .c1 checked (on) set c1 b ;# .c1 unchecked (off) set c1 c ;# .c1 checked with grey background (tristate) set c2 a ;# .c2 checked (on) set c2 b ;# .c2 unchecked (off) unset c2 ;# .c2 checked with fill-dot check (tristate) [JH] - as noted above
time {foreach {a b c} [list de da lus] {break}} 1000 2.396 microseconds per iteration time {lassign [list de da lus] a b c} 1000 1.632 microseconds per iteration
proc a {} { foreach {a b c} [list de da lus] {break} return } proc b {} { lassign [list de da lus] a b c return } time {a} 1000 1.643 microseconds per iteration time {b} 1000 1.234 microseconds per iteration
ttk::treeview -show tree pack .t -fill both -expand 1 .t insert {} end -id 1 -text de .t insert 1 end -id 3 -text da .t insert 1 end -id 4 -text lus .t insert 4 end -id 5 -text ika .t insert 4 end -id 6 -text rus .t insert {} end -id 2 -text foo
This are my personal first impression. And it covers only a small part of the new features.
AM This seems a good place to add a link to Mark Roseman's overview of Tcl/Tk 8.5: [L1 ]
2007-12-26 HE Some new impression:
time {if {[lsearch -exact [list de da lus] {da}]!=-1} {}} 1000 1.134 microseconds per iteration time {if {{da} in [list de da lus]} {}} 1000 0.701 microseconds per iteration proc c {} { if {[lsearch -exact [list de da lus] {da}]!=-1} {} return } proc d {} { if {{da} in [list de da lus]} {} return } time {c} 1000 1.417 microseconds per iteration time {d} 1000 1.05 microseconds per iteration time {if {[lsearch -exact [list de da lus] {da}]==-1} {}} 1000 1.132 microseconds per iteration time {if {{da} ni [list de da lus]} {}} 1000 0.695 microseconds per iteration proc c {} { if {[lsearch -exact [list de da lus] {da}]==-1} {} return } proc d {} { if {{da} ni [list de da lus]} {} return } time {c} 1000 1.487 microseconds per iteration time {d} 1000 1.05 microseconds per iteration
unset n time {if {![info exists n]} {set n 0};incr n} 1000 0.678 microseconds per iteration unset n time {if {![info exists n]} {set n 1} else {incr n}} 1000 0.655 microseconds per iteration unset n time {incr n} 8 microseconds per iteration unset n proc e {} { if {![info exists n]} {set n 0};incr n return } proc f {} { if {![info exists n]} {set n 1} else {incr n} return } proc g {} { incr n return } time {e} 1000 0.921 microseconds per iteration time {f} 1000 0.803 microseconds per iteration time {g} 1000 1.864 microseconds per iteration
IDG Dec. 28, 2007. tk_messageBox seems to use ttk buttons by default. This is ... surprising. Is there a simple way to cause reversion to the traditional look?
HE It looks like you are using a unix-like system. On this platforms tk_messageBox is mapped on tk::MessageBox (file lib\tk8.5\msgbox.tcl distributed but not used by tcl/tk on w32 systems). I don't know if someone would change this file to use no ttk-widgets. If you don't need the new parameter -detail, you can get an older version of the file msgbox.tcl from sourceforge [L2 ] and replace the original file in your installation. If you can't change your installation you can source this file into your scripts. On w32 systems you also need to run
proc ::tk_messageBox {args} { return [tk::MessageBox {*}$args] }
DKF: Or just run tk::MessageBox directly.
idg Sure - there is no problem with new code. There may be a problem when old apps look different, and users don't like it. I thought the general philosophy with ttk in 8.5 was that you should get the old widgets unless you specifically asked for the new...
HE This is my understanding too. But looking inside shows something different:
The default dialogs (used on unix-like systems in the files tkfbox.tcl, msgbox.tcl ...) using ttk-widgets but existing in namespace tk. This looks like a compromise between compatibility and platform look and feel. From my point of view it was better to use standard widgets for standard dialogs in namespace tk. If their is the need for theming dialogs, it is possible to create a second set (like the second set of widgets) in the namespace ttk.
More annoying: What sense makes packages if they are always loaded? Defining packages means for me loading code on demand not always.
I changed msgbox.tcl so it works without ttk-widgets. On XP it looks perfect. No need for the use of theming widgets. At least for me.
I think (and hope) their was a lot of discussions about this in the past. So I will try to live with this situation.
EB find this discussion funny. While ttk is an effort to make people stop saying Tk looks ugly, you are complaining on users of old applications who don't like it. Personaly, I find ttk is a big step forward. I don't know one person (Tcl'er or not) saying Tk is worse than before. All my developments are done with 8.4/Tile since long time now, and a lot of people are surprised that it is written in Tcl/Tk.
About the package require, anyway, all the ttk code is now in the tk library. And also note that Tk require msgcat.