1 / 14

TCL/TK

TCL/TK. tool command language toolkit. 指导老师:肖炳甲 学生:林冬涛. 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.

khan
Download Presentation

TCL/TK

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. TCL/TK tool command languagetoolkit 指导老师:肖炳甲 学生:林冬涛

  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

  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.

  4. Featuresand 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 LanguagesvsSystemProgrammingLanguages 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. 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. 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

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

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

More Related