Presentation is loading. Please wait.

Presentation is loading. Please wait.

TCL/TK 指导老师:肖炳甲 学生:林冬涛 tool command language toolkit.

Similar presentations

Presentation on theme: "TCL/TK 指导老师:肖炳甲 学生:林冬涛 tool command language toolkit."— Presentation transcript:

1 TCL/TK 指导老师:肖炳甲 学生:林冬涛 tool command language toolkit

2 Tcl was designed from the outset as a flexible language with a small core, that could be adapted in ways the original authors couldn't have foreseen. Tcl truly is a general purpose language. 1.Web Applications Tcl, being a dynamic, string oriented language, is a great match for web applications. 2. Desktop GUI Applications Tk helped establish Tcl's popularity as the only sane way to write GUI applications under Unix and X11. People found Tcl's dynamic approach a natural fit for GUI's, making GUI development much easier and faster than with lower-level C and C++ oriented toolkits. 3. Testing and Automation Long before "test-driven development" had become a buzzword, Tcl had been well established as a testing powerhouse, leveraging its ability to easily interface with other software and hardware. 4. Databases 5. Embedded Development Tcl and Tk Applications

3 Who uses Tcl and Tk? “We use a Tcl interpreter in each of the hundreds of back-end host processes that provide services to AOL's Digital City's 3 million monthly visitors. Tcl greatly simplifies the task of configuring these services and managing them remotely. In addition, we are using Tcl to create high performance, completely dynamic, database driven Web sites. Every Web page in the AOL's Digital City network is generated by an embedded Tcl script.“ Jim Davidson, Chief Technology Officer AOL's Digital City, Inc. It's used by elite hackers, application programmers, system administrators, and scientists. Tcl runs the operator interface of a Shell Oil drilling rig, runs the NBC network control system 24x7, has been used to program the Hubble Space Telescope and prototype the Mars Pathfinder, is hiding in every Tivo box and many Oracle products. Don't forget companies like Pixar, Motorola, IBM, Sybase, Nortel, Raytheon...

4 Features and Benefits 1.Rapid development In many cases you can implement applications 5-10x faster with Tcl than with other languages, especially if the application involves GUIs, string-handling, or integration. 2.Graphical user interfaces With its Tk toolkit, Tcl provides facilities for creating GUIs that are incredibly simple yet remarkably powerful. 3. Cross-platform applications 4. Easy to learn Tcl is a very simple language. Experienced programmers can learn Tcl and produce their first interesting application in just a few hours or days. 5.Mature but Evolving 6.Extend, Embed and Integrate Tcl is unmatched when it comes to integrating with other software. You can easily include Tcl as an embedded scripting language in an application, or make existing C, C++, or Java code look like it wasbuilt right into Tcl. 7.Deployment 8. Network-aware applications

5 Comparison Dynamic Languages vs System Programming Languages Tcl Python Java C++ complex data structures and algorithms quickly manipulate data less rigidly defined, and determined at runtime typically interpreted, highly introspective, and emphasize integration and extension to add new capabilities. programs are shorter, much faster to develop Choosing a Dynamic Language Why Tcl? a rich deployment model that is second to none, including support for protecting commercial applications Tk is designed explicitly for Tcl; while it works well with other languages, the API is both more natural, more current, and better documented built-in event-driven programming model for networks, GUI's, and more supports a wide variety of programming styles, including procedural, several styles of object-oriented, and others, and is great for building domain specific languages excellent internationalization support

6 Basic syntax command arg1 arg2 arg3 Where do commands come from? Provided by Tcl interpreter itself Tcl provides APIs that allow you to create a new command by writing a command procedure in C/C++ Consisits of procedures created with proc command

7 Tk Concepts widgets, geometry management, and event handling

8 Window Hierarchy The root of the hierarchy, the toplevel widget that Tk automatically creates, is named simply "." (dot). The frame, which was a child of the root, was named ".c". The labels,buttons and so on are children of frame grid [ttk::label.c.flbl -text "feet"] -column 3 -row 1 -sticky w grid [ttk::label.l -text "Starting..."] bind.l {.l configure -text "Moved mouse inside"}

9 Basic Widgets

10 The Grid Geometry Manager Grid is one of several geometry managers available in Tk, "pack" is also quite powerful, but harder to use and understand; "place" gives you complete control of positioning each element; we'll see even widgets like paned windows, notebooks, canvas and text can act as geometry managers. grid.c.namelbl -column 3 -row 0 -columnspan 2


12 Tree A treeview widget can display and allow browsing through a hierarchy of items, and can show one or more attributes of each item as columns to the right of the tree. ttk::treeview.tree

13 ET:EPICS TCL/TK Interface The BLT Toolkit is an extension to Tcl and Tk. It adds new commands and widgets to the Tcl interpreter. Included widgets are 2D graph, barchart, stripchart, tab notebook, and tree viewer. tcl command (pv) and command operations (link, linkw, get, getw, put, putq, mon, umon, cmon, info, stat, vset, vset, and vmap) which are used to interface with EPICS. The tcl package libraries upon which et is built include tk and blt.

14 caTCL caTCL requires that the X11, Tk/Tcl, DP, and BLT header files and libraries be available and that the X11, TK, TCL, and BLT settings in CONFIG_SITE. be set correctly.

Download ppt "TCL/TK 指导老师:肖炳甲 学生:林冬涛 tool command language toolkit."

Similar presentations

Ads by Google