In order to enhance the interaction between the ATOP program and tcl/tk, we discuss how to use python to write the ATOP program to effectively run the existing TCL script function and enhance the functionality of the ATOP program.
TCL (It was originally called "Tool Command Language", but it no longer means this, but we still Call it TCL) is a scripting language. Created by John Ousterhout. TCL is easy to learn and has powerful functions. TCL is often used for rapid prototyping, scripting, GUI and testing. TCL is pronounced "tickle".
The features of Tcl include: (Recommended learning: Python video tutorial)
* Everything is a command, including syntax structures (for , if, etc.).
* Everything can be redefined and overloaded.
* All data types can be regarded as strings.
* The syntax rules are quite simple
* Provide event driver for Sockets and files. Time-based or user-defined events are also possible.
* Dynamic domain definition.
* Easily extendable in C, C++, or Java.
* Interpreted language, code can be changed dynamically.
* Full Unicode support.
* Platform independent. It can run on Win32, UNIX, and Mac.
* Tightly integrated with Windows GUI. Tk
* The code is compact and easy to maintain.
TCL itself does not provide object-oriented support. But the language itself is easily extended to support object orientation. Many C language extensions provide object-oriented capabilities, including XOTcl, Incr Tcl, etc. In addition, the SNIT extension itself is written in TCL.
Python has two functions for executing TCL:
1. In-process execution (including TCL parser) is implemented using the eval command
2. Out-of-process execution calls tclsh/wish.exe for execution. This method is consistent with the current ATOP method.
Python runs tcl script
From Tkinter import Tcl r=Tcl() r.eval('package require itclx') r.eval('cd $env(TCLSPACE)/ATOP') r.eval('source lib/ct/ctCaseDv.tcl') r.eval('source lib/ct/ctCaseDv.tcl')
Use the eval command to execute the tcl script.
Function:
1) Commonly used operations, such as Excel to tcl, refreshing XML directory tree, and other functions can be integrated into ATOP
2) Strengthen the relationship between GUI and TCL communication between.
For more Python related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of Why does python have tcl. For more information, please follow other related articles on the PHP Chinese website!