1 / 9

An Overview of Tcl/Tk Programming

An Overview of Tcl/Tk Programming. Tcl/Tk.

teo
Download Presentation

An Overview of Tcl/Tk Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Overview ofTcl/Tk Programming

  2. Tcl/Tk • Tcl (Tool Command Language) is used by over half a million developers worldwide and has become a critical component in thousands of corporations. It has a simple and programmable syntax and can be either used as a standalone application or embedded in application programs. Best of all, Tcl is open source so it's completely free. • Tk (Toolkit) is a graphical user interface toolkit that makes it possible to create powerful GUIs incredibly quickly. It proved so popular that it now ships with all distributions of Tcl.

  3. History of Tcl/Tk • Tcl/Tk is actually two products originally developed at the University of California Berkeley, now at Sun by John Ousterhout: the Tool Command Language and the Tool Kit. They are a versatile scripting language and a graphical interface development tool, respectively. • Tcl/Tk can be used for GUI (Graphical User Interface) development with the powerful Tk. Tcl/Tk runs as a plugin from web browsers made by Netscape and Microsoft, so it can be used instead of JavaScript and VBScript. It is a CGI language and can be used in servers. Tcl/Tk is also extremely extendable and is valuable to C/C++ programmers who want to learn a high-level scripting language for their user interfaces or for integrating pieces of a large system.

  4. Tcl Praisehttp://www.tcl.tk/customers • " We use a Tcl interpreter in each of the hundreds of back-end host processes that provide services to Digital City's 4.5 million monthly visitors. Tcl greatly simplifies the task of configuring these services and managing them remotely. " Jim Davidson, Chief Technology Officer, AOL's Digital City. • " Tcl is the best scripting language for our mission-critical testing environment, bringing us several advantages. Tcl is easy to use, is embeddable and extensible, and has allowed us to automate our testing tasks to a much higher degree than we otherwise could. " Jay Yang, manager, Automated Test Solutions at Cisco. • " Before we began using Tcl, we found that our current development methods and tools for system management were unable to keep up with the pace of change. With Tcl, we find that we can now respond to changes very quickly. " Marc Rossi, member of the GAS development team at NationsBank.

  5. Recommended Tcl/Tk References • Tcl Developer Exchange: http://www.tcl.tk/ http://www.tcl.tk/doc/ (online documentation) http://www.tcl.tk/community/features/ • For a great introduction (CD included): Graphical Applications with Tcl & Tk Eric Foster Johnson • For more advanced users: Effective Tcl/Tk Programming Mark Harrison and Michael McLennen

  6. Tcl 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

  7. Some 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 BWidget library provides a nice professional looking set of Tcl/Tk widgets and is located on tyr in /usr/local/BWidget. Type /usr/local/BWidget/demo/demo.tcl on tyr.

  8. Some Tk Widget Options • -background background color • -command executes script/proc • -foreground foreground color • -height sets height normally in pixels • -image image to display in widget • -state normal, disabled or active • -text sets text to display • -textvariable get text to display from here • -width sets width normally in pixels

  9. Tcl/Tk Examples • All in: /home/mitchell/mitchell.linux/tcltkExamples • book/chap1/hello.tcl • book/chap2/for1.tcl, foreach1.tcl, arrayset.tcl • book/chap3/check1.tcl, check2.tcl, scale1.tcl, textvar.tcl, frame1.tcl, frame2.tcl, rgbscale.tcl • book/chap5/password.tcl, dataform.tcl

More Related