50 likes | 159 Views
Tcl/Tk Part 2. Overview of Basic Tk Widgets. widget name arguments = basic Tk syntax button calls tcl code when pushed checkbutton on/off (toggle) button entry text-entry widget frame frames widgets inside a box label displays text message listbox scrolled list
E N D
Overview of Basic Tk Widgets widget name arguments = basic Tk syntax • button calls tcl code when pushed • checkbutton on/off (toggle) button • entry text-entry widget • frame frames widgets inside a box • label displays text message • listbox scrolled list • radiobutton on/off button set; only one on • scale analog value from min to max • text text-entry widget
Overview of Tcl/Tk Syntax • Command arg1 arg2 arg3 = execute the command with the given arguments • “Text in quotes” = pass text in quotes as one arg; perform command and variable substitution • {Text in braces} = pass text in braces as one arg; defer command and variable substitution • $variable or ${variable} = substitute the value of the given variable • [command arg] = execute command; substitute value for command between square brackets • Command arg1 \ arg2 = extend command over one line • command 1; command 2 = two commands on one line
Tcl/Tk Demos • BWidget – widget library application • Tktable – table application written in C • BLT – graphs application These can be used to help build new applications and are all installed in the /usr/local directory of the machines sif and tyr. You can learn much from studying the code of these demos.
Running the Demos on sif and tyr • BWidget /usr/local/BWidget/demo/demo.tcl • Tktable (demos not in /usr/local) cd ~mitchell/Tktable2.8 demos/basic.tcl, demos/buttons.tcl • BLT cd /usr/local/blt/lib/blt2.4/demos /usr/local/blt/bin/bltwish spline.tcl /usr/local/blt/bin/bltwish stripchart1.tcl