'''Tk''', by [John Ousterhout], is a cross-platform graphical toolkit for [Tcl], providing the tools necessary to to develop graphical applications that run on Windows, Linux, MacOSX and many other platforms. '''Tk''' stands for "toolkit". ** Development ** [http://core.tcl.tk/tk/timeline?y=ci%|%official source code repository]: [http://core.tcl.tk/tk/reportlist%|%bug tracker]: [http://tktoolkit.sourceforge.net/%|%sourceforge project page] ([http://sourceforge.net/projects/tktoolkit%|%alternate]): hosts the histoical source code repository and bug tracker ** Description ** [wish] is a [Tcl] shell that is distributed with Tk and extended by the Tk commands. Historically, Tk was usually used via [wish], but the modern way is to treat Tk as any other [Tcl] extension, using `package require` to load it. For historical information, see [using Tk as a loadable package]. When [wish] is used on Windows to run Tk programs, there is no associated [Microsoft Windows%|%Windows] console, and output to standard channnels (e.g. using `[puts]`) is displayed in in a window provided by Tk called "console". Tk has been adopted by many other languages, including [Python] and [Perl]. To this end, most of these other languages also include a full Tcl build, and there is usually some way to access the Tcl interpreter directly. [Perl/Tk], on the other hand, rewrote all of Tk in a way that wasn't bound to Tcl, for example. See [Tcl and other languages]. ** Tk Package ** see [Tk Package] ** Tk Command ** '''tk''' is also the name of a Tk command. See: http://www.tcl.tk/man/tcl/TkCmd/tk.htm : '''[tk appname]''' ?''newName''? : '''[tk busy]''' ''subcommand ...'' : '''[tk caret]''' ''window'' ?'''-x''' ''x''? ?'''-y''' ''y''? ?'''-height''' ''height''? : '''[tk inactive]''' ?'''-displayof''' ''window''? ?'''reset'''? : '''[tk fontchooser]''' ''subcommand ...'' : '''[tk scaling]''' ?'''-displayof''' ''window''? ?''number''? : '''[tk useinputmethods]''' ?'''-displayof''' ''window''? ?''boolean''? : '''[tk windowingsystem]''' ** Features ** [Drag and Drop] support: [Tk's copy and paste support]: support for unicode display: support for multiple monitors: ** Introductions ** [An Overview of Tcl and Tk]: [An X11 Toolkit Based on the Tcl Language]: the first presentation of Tk, Circa 1991 [Intro to Tk]: describes what Tk is and why it is so unique. [Building User Interfaces with Tcl and Tk]: [Tk Sets The Standard by Cameron Laird and Kathryn Soraiz]: ** Tutorials ** [online Tcl and Tk tutorials]: [Beginning Tk]: Tk resources at the beginning level [http://www.bin-co.com/tcl/tutorial/%|%A Tcl(Tutorial for Cool Languages) for Tcl/Tk]: by Binny V A, and[http://www.geocities.com/binnyva/code/perl/perl_tk_tutorial/%|%in Perl]. ** Documentation ** [http://www.tcl.tk/man/tcl/TkCmd/contents.htm%|%reference manual]: [Tk Commands]: [Tk syntax help]: basic Tk syntax [Ttk]: Themed Tk, now part of Tk [http://www.bodenstab.org/%|%Updated Tcl/Tk Quick Reference Guide]: Paul Raines' reference, updated by Dave Bodenstab. [http://www.slac.stanford.edu/%7Eraines/tkref.html%|%Tcl/Tk Quick Reference Guide]: by Paul Raines. Printable. [Tk coding styles and philosophies]: best coding practices for Tk [User Interface Design for Tcl/Tk]: [Tk Sets The Standard by Cameron Laird and Kathryn Soraiz]: [http://phaseit.net/claird/comp.lang.tcl/tk.html%|%Cameron Laird's personal notes on Tk]: [CL] hints at the advantages Tk interfaces enjoy over both Web applications and traditional Visual Basic form-oriented GUIs. He's published dozens of other articles on various aspects of Tk [Cross Platform differences in Tcl/Tk]: ** Instructional Pages ** [Bag of Tk algorithms]: useful Tk code examples [Tk examples]: more Tk examples ** Programs ** [Tk Programs]: [Tcl/Tk games]: ** See also ** [addinput]: [built-in visual elements]: [Category Tk Library]: for discussions on various functions in the Tk C [API]s. [Coming to Tcl/Tk from an IDE environment]: [GUI Building Tools]: [History of Tk]: [How Tk compares to other GUI toolkits]: [Beginning Tcl]: [megawidget]: [taming wild windows]: [The TK GUI - Q&A]: [tktoolkit]: [TkDocs]: [Mark Roseman]'s: valuable ste focuses on "the latest modern Tk features ...". [Useful Tk Widgets]: a catalog of widgets [http://www.subdude-site.com/WebPages_Local/RefInfo/Computer/TclTk/others_tkGUIs/others_tkGUIs.htm%|%tkGUIs]: of various applications] ** Implementations ** The Tk specification is operationally defined by the reference implementation, and the following projects attempt at least some level of conformity to it. [NexTk], by [George Peter Staplin]: intended as a next-generation implementation of Tk [Tk Widgets in Javascript], by [Arnulf Wiedemann]: part of the [incr Tcl in Javascript]: ** Design ** Tk has an [X]lib Emulation Layer [XLEL], which is one part in making Tk work across different platforms. That there is such a level is an important reason why [Tk generation when X11 headers are missing] can be an issue: the Tk source uses X11 headers even when Tk at runtime uses some other windowing system. double-buffering examples; ...]] ** Discussion ** [RS] 2013-10-08: I just spent some time debugging an app where, mysteriously, switches disappeared from the command line ([argv]). Turned out that Tk snatched them away. Demonstrations in an interactive [tclsh]: ======none % set argv {-c 1 -d 2 -g 3 -n 4 -s 5 -u 6 -v 7} -c 1 -d 2 -g 3 -n 4 -s 5 -u 6 -v 7 % package require Tk this isn't a Tk applicationwindow "6" doesn't exist % set argv 5 ====== The Tk options are documented: ====== -colormap new -display display -geometry geometry -name name -sync -use id -visual visual -- ====== and a 1-character match is sufficient to take them away (the `5` remained because the `-s` option does not take an argument). Solution, if you don't want to use any of the Tk options: insert the protective -- at the beginning of argv: ====== % set argv {-c 1 -d 2 -g 3 -n 4 -s 5 -u 6 -v 7} -c 1 -d 2 -g 3 -n 4 -s 5 -u 6 -v 7 % set argv [linsert $argv 0 --] -- -c 1 -d 2 -g 3 -n 4 -s 5 -u 6 -v 7 % package require Tk 8.4 % set argv -c 1 -d 2 -g 3 -n 4 -s 5 -u 6 -v 7 ====== [Martyn Smith]: The other choice is to protect the argv variable contents before running the package require that way the end user does not need any special action. ---- Has anyone been thinking adding a tutorial for Tk into the Tk source code distribution, similar in concept to the Tcl tutorial being added in Tcl 8.5? [DKF]: Thinking? Yes. Doing anything about it? No. A set of lessons for Tk would be a ''very'' welcome addition! ---- [[Things to explain: Bryan Schofield's posting on multiple Tk interpreters; [[Insert here pointers and discussions regarding Tk features]] <> Tk syntax help | Arts and Crafts of Tcl-Tk Programming | Command | Package