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 and Tk Applications
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 1.Web Applications Tcl, being a dynamic, string oriented language, is a great match for web applications. Rather than taking a one-size-fits-all approach, a number of different solutions have evolved: For massively scalable database backed websites, the Tcl powered AOLserver (which runs some of AOL's largest sites) is ideal, often paired with the OpenACS community system. TclHttpd is a high performance, highly programmable web server that is designed to run either standalone or to be embedded in other applications — written in pure Tcl. Skeptical? It's running this site right now. Tcl can also be used as a conventional web programming language; a number of CGI libraries are available, including ncgi which is part of Tcllib. Another option is Rivet, which runs as an Apache module. 3..Testing and Automation Companies like Oracle, Sybase and Cisco have millions of lines of Tcl testing code on which they rely to assure the operation of their flagship products. 4.Databases Tcl has extensions available to use all the standard databases, whether MySQL, Oracle, Sybase, PostgreSQL, Berkeley DB, ODBC-compliant databases, and many more. 5.Embedded Development Because Tcl is a very compact(紧凑型) language, and is easily integrated with special hardware, it is a popular choice for embedded development.

3 Who uses Tcl and Tk? 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... “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. Tivo 机顶盒 AOL American on_line

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 2.Graphical user interfaces 3. Cross-platform applications Tcl/Tk runs on Windows, Macintosh, and nearly every imaginable Unix platform. It provides high-level API's that let you write code that works the same — everywhere — while Tcl/Tk worries about respecting platform differences, such as native look and feel for GUI's. 5. Mature but Evolving Tcl and Tk have been under continuous, active development and use by a large group of developers since the early 1990's. 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 was built right into Tcl. The same features make it easy to use Tcl as a control language for special-purpose hardware or protocols, add a new GUI or network interface to legacy applications, and more. 7. Deployment Dynamic languages often make deployment harder, because you need to get both the language interpreter and the application scripts onto the target machine. Most dynamic languages provide tools to "compile" everything into a single executable (Tcl has had that too, since about 1993). But Tcl/Tk goes way beyond those simple solutions, using technologies like the Tcl Virtual File System, and Starkits and Starpacks to make deployment more flexible, powerful and transparent. Other options allow commercial applications to protect their intellectual property, a rare capability in dynamic languages. A Starkit is a single file packaging of Tcl scripts, platform specific compiled code and application data; designed to facilitate simple deployment of cross platform applications. The name comes from STandAlone Runtime. 8. Network-aware applications Tcl has a rich and powerful event-driven programming model that makes network programming easy, allowing clients and servers to be created with just a few lines of code. Networking, files, GUI events — all work the same way, making for a consistent, easy to learn and powerful programming style, without relying on extra libraries.

5 Comparison Dynamic Languages vs System Programming Languages Tcl
Python Java C++ 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 complex data structures and algorithms 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 Where do commands come from?
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 <Enter> {.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

11 A canvas widget manages a 2D collection of graphical objects — lines, circles, images, other widgets and more. Tk's canvas is an incredibly powerful and flexible widget, and truly one of Tk's highlights.

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

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.<host_arch> be set correctly.


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

Similar presentations


Ads by Google