[WJG] (23/11/08) One of the many enhanced formatting features of Gtk widgets is the use of the Pango for text formatting[http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html]. Whilst this isn't a feature that the developer will want to use every label, it has its uses when colour or font effects are desirable. Here's a brief sample derived from a recent posting of Tk code taken from the Tcl newsgroup.
----
[http://wjgiddings.googlepages.com/pangoTML.png]
----
And here's to code to produce this:
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
set etitle "Tcl/Tk 8.5"
proc nullcmd {} {
global type
puts -nonewline "8.5 "
puts $type
}
#1) create buttons, format strings with markup code
set lab [gnocl::label -text {%<RADIOBUTTONS } ]
set rb1 [gnocl::radioButton -text {%<serial } -variable type -onValue "serial" -onToggled nullcmd]
set rb2 [gnocl::radioButton -text {%<-non-Serial } -variable type -onValue "newnonser" -onToggled nullcmd]
set rb3 [gnocl::radioButton -text {%<cross-Ref } -variable type -onValue "crossref" -onToggled nullcmd]
set rb4 [gnocl::radioButton -text {%<CODEN Only } -variable type -onValue "codenonly" -onToggled nullcmd]
set cb1 [gnocl::checkButton -text {%<CheckButton } ]
#2) create container and add the buttons
set box [gnocl::box -orientation vertical]
$box add [list $lab $rb1 $rb2 $rb3 $rb4 $cb1 ]
#3) create toplevel and add the widgets in one drop
set win [gnocl::window -title $etitle -child $box -onDelete {exit} ]
gnocl::mainLoop
----
By way of comparison, here's a screengrab of the layout that the Tk code posted produced running on my Linux box, mmm... very retro...
[http://wjgiddings.googlepages.com/tkSample.png]
[ZB] Were there any problems with using Ttk (instead of "ordinary" Tk)?
[WJG] (24/11/08) Problems,no. The Tk script ran smoothly.
----
!!!!!!
%| enter categories here |%
!!!!!!