tcl

Understanding what files in the TCL are required for distributing frozen Python Tkinter apps

徘徊边缘 提交于 2021-02-10 07:52:46
问题 I'm trying to figure out which files in Python's (Python 2.6/Python 2.7) tcl folder are required in order to distribute frozen Python Tkinter apps using Py2exe or similar. The quick and dirty way to do this (using pyexe as an example) is to follow the 2nd example on the following page and then xcopy your python's tcl folder to your dist folder (as a tcl sub-folder). http://www.py2exe.org/index.cgi/TixSetup The problem with the xcopy tcl technique is that it copies 100's of extra files that

Why does tcl/tkinter only support BMP characters?

孤街醉人 提交于 2021-02-08 15:10:26
问题 I am trying to query and display utf-8 encoded characters in a gui built on tkinter and thus tcl. However, I have found that tkinter cannot display 4-byte characters i.e. unicode codepoints greater than U+FFFF. Why is this the case? What limitations would implementing non-BMP characters have for tcl? I can't query non-BMP characters through my gui, but if they come up in a result I can copy/paste the character and see the character/codepoint through unicode-table.com despite my system not

Why does tcl/tkinter only support BMP characters?

允我心安 提交于 2021-02-08 15:06:52
问题 I am trying to query and display utf-8 encoded characters in a gui built on tkinter and thus tcl. However, I have found that tkinter cannot display 4-byte characters i.e. unicode codepoints greater than U+FFFF. Why is this the case? What limitations would implementing non-BMP characters have for tcl? I can't query non-BMP characters through my gui, but if they come up in a result I can copy/paste the character and see the character/codepoint through unicode-table.com despite my system not

Array to string in TCL

妖精的绣舞 提交于 2021-02-08 11:48:19
问题 How can I convert a known array in to string in TCL? an array might have values such as root_user_appversion 10.1.3.20 and/or I just want to take out the last values out of it which 10.1.3.20 . 回答1: You can transform the array in list: set my_list [array get my_array] puts "last element: [lindex $my_list [expr {[llength $my_list] -1}] ]" After that, you can easily convert your list in string with join : set my_string [join $my_list " "] 回答2: I think you want join [dict values [array get the

how to use regex in switch case in expect script?

本小妞迷上赌 提交于 2021-02-08 11:45:47
问题 Normally, switch case in expect looks like this: switch -- $count \ 1 { set type byte } 2 { set type word } big { set type array } default { puts "$count is not a valid type" } I need to use regex operators such as | or & - how can I do that? The below example does not work with expect code : switch -- $variable \ ("a"|"b"|"c") { do something } ("a"|"b"|"c") represents a or b or c, but it does not seem to work. How do I use such statements in switch or may be an and statement? 回答1: Use the

expect - telnet connection

谁说我不能喝 提交于 2021-02-08 08:20:30
问题 I'm trying to create a simple telnet connection script. I spawn telnet process. Depending on the version, it may or may not ask for password. After that It asks for username and password and rulese acceptation. After successful login it prompts for command. However, thing I wrote does not work. #/usr/bin/expect -f set IP [lindex $argv 0] set timeout 10 set send_slow {10 .5} log_user 1 spawn telnet -l cli $IP expect { timeout { puts "Network Connection Problem" close } "Password:" { send -s --

expect - telnet connection

偶尔善良 提交于 2021-02-08 08:19:36
问题 I'm trying to create a simple telnet connection script. I spawn telnet process. Depending on the version, it may or may not ask for password. After that It asks for username and password and rulese acceptation. After successful login it prompts for command. However, thing I wrote does not work. #/usr/bin/expect -f set IP [lindex $argv 0] set timeout 10 set send_slow {10 .5} log_user 1 spawn telnet -l cli $IP expect { timeout { puts "Network Connection Problem" close } "Password:" { send -s --

How to detect the completion of a Tcl coroutine?

别来无恙 提交于 2021-02-07 21:49:48
问题 I'd like to find a nice way in Tcl to detect the end of a coroutine. Consider: coroutine cor apply {{} { yield 1 yield 2 yield 3 }} try { puts [cor] puts [cor] puts [cor] puts [cor] } trap {TCL LOOKUP COMMAND cor} {e} { puts "done" } This works, but it feels like a hack and it is brittle. If I rename cor and forget to rename it in the trap, it fails. If I leave out the cor in the trap, it will catch unrelated typos. There's got to be a better way. What is it? 回答1: To detect if a command still

It is difficult to handle multiple dimension list with tcl

蓝咒 提交于 2021-01-29 20:53:52
问题 I need to handle kind of complex data with tcl. I need 3 dimension list to store the data, but I find tcl is bad for this work. Based on my current study, tcl does not support simple index of list like: listname(index). So for multiple dimension list, if I want to assign a new value for certain element, it will be very troubling. Are there some skills to handling data effectively? 回答1: The most efficient representation for a multi-dimensional array is a nested list (unless you're going for a

Tcl interpreter undefined reference error while compiling with gcc

帅比萌擦擦* 提交于 2021-01-29 18:06:24
问题 I am new to Tcl scripting and would like to use C to embed Tcl codes. This is the code that I have copied from a website to test the Tcl-C working. test.c #include <stdio.h> #include <tcl.h> void main () { Tcl_Interp *myinterp; char *action = "set a [expr 5 * 8]; puts $a"; int status; printf ("Your Program will run ... \n"); myinterp = Tcl_CreateInterp(); status = Tcl_Eval(myinterp,action); printf ("Your Program has completed\n"); getch(); } I am using MinGW to compile this file. I have