Tclpysh: Multi-language shell supporting both Tcl and Python

4 months ago 5
What:tclpysh
Where:https://dashthru.com/tclpysh
Description:tclpysh is a multi-language command line interface supporting Tcl and Python, developed by DashThru Technology, Ltd.
OS:Linux (el6/el7/el8)
Python:CPython 3.6+
Release:Currently at v2025.06
Contact:trial at dashthru.com

Introduction

tclpysh is a multi-language shell supporting both Tcl and Python with native variable sharing, enhanced Ctrl-C interrupt support and mixed language script sourcing. It also can be imported into the Python shell of latest EDA tools.


Advantages

Unlike traditional approach such as tkinter that separates Tcl and Python into distinct modes and environments, tclpysh enables both languages to be written in a single script, with real-time language switching ability.

Real-time Ctrl-C interruption is also available with no limitation such as inside a while loop, with extended command 'defer' for advanced interrupt behavior handling.


Variable Sharing Example

% tclpysh tcl> set a 123 123 tcl> pymode py> a '123' py> a+='456' py> tclmode() tcl> puts $a 123456

Mixed Language Script Sourcing Example

#!/tclpysh_py39_v2025.06/bin/tclpysh set a 0 pymode print(f'python: a = {a}') b='1' tclmode() puts "tcl: a = $a" puts "tcl: b = $b" exit

Enhanced Ctrl-C Interrupt Examples

tcl> while 1 { incr i } ^C Info: Ctrl-C interrupt: 'while 1 { incr i }'. (SHELL-INTRCMD) tcl> puts $i 937237
tcl> proc p {} { defer -intr { puts "value is $i!" } while 1 { incr i } } tcl> p ^CInfo: Ctrl-C interrupt is handled by 'defer -intr' command. (SHELL-INTRRECOVER) value is 219811! tcl>

How to Get

https://dashthru.com/freetrial


AMB - 2025-06-12 04:04:46

Finally, an implementation of TIP #365

Read Entire Article