Questions tagged [tcl]
Tool Command Language was invented by John Ousterhout as a way to make it easy to write little languages for configuring EDA tools, but it has grown far beyond those humble beginnings to become a general scripting language with built-in asynchronous I/O and Unicode strings while supporting paradigms such as object-oriented programming and coroutines.
8,024
questions
85
votes
4
answers
151k
views
List of All Tkinter Events
In Python tkinter module, <Button-1>, <Button-2> and <Button-3> are used to identify mouse button clicks for left, middle and right buttons respectively.
Likewise, <KeyPress-...
74
votes
8
answers
154k
views
How to make a GUI for bash scripts? [closed]
I want to make some graphical dialogs for my script but don't know how.
I hear something about GTK-Server or something like that.
If someone knows how to link Bash with tcl/tk I also be satisfied.
...
73
votes
7
answers
50k
views
Cannot launch Git GUI using Cygwin on Windows
I used to launch Git GUI within my Cygwin console without any problems, but since I updated Cygwin I've got the following error message:
$ git gui
Application initialization failed: no display name ...
69
votes
3
answers
101k
views
Get the version of TCL from the command-line?
I'm looking for a very straight-forward way of getting the version of the TCL installed on a machine from the command-line. For most programming languages, something along the lines of
languagename -...
67
votes
5
answers
120k
views
Waiting for background processes to finish before exiting script
How do I make sure that all my background processes have finished execution before I exit my script (TCL/Bash).
I was thinking of writing all my background process pids to a pidfile. And then at the ...
36
votes
2
answers
102k
views
How to set border color of certain Tkinter widgets?
I'm trying to change the background color of my Tkinter app, but for certain widgets it leaves a white border around the edges.
For example, this:
from tkinter import *
COLOR = "black"
root = Tk()
...
35
votes
7
answers
89k
views
error: curl: /usr/local/lib/libcurl.so.4: no version information available (required by curl)
Hello i have this error when i run curl from tcl error: curl:
/usr/local/lib/libcurl.so.4: no version information available (required by curl)
curl --version
curl 7.40.0 (x86_64-unknown-linux-gnu)...
34
votes
2
answers
1k
views
Complex number arithmetic in Tcl?
Is there an equivalent to the expr command which works for complex numbers (represented lists of two doubles)?
This library provides functions for complex number arithmetic, and this seems to be a ...
30
votes
5
answers
44k
views
Why is topdir set to its default value when rpmbuild called from tcl?
I have a tcl script which 'exec' rpmbuild. When doing so, the 'topdir' used by rpmbuild is wrong. I have a .rpmmacros file in my home directory and if I call manually rpmbuild, it works fine, ie. the '...
28
votes
4
answers
111k
views
TCL string concat
What is the recommended way of concatenation of strings?
28
votes
4
answers
56k
views
Read Bash environment variable in TCL
How to read a shell environment variable in your Tcl script.
So anyone please help me. I am very new in TCL.
28
votes
2
answers
24k
views
Any difference between "send_user" and "puts" in Expect?
It's not clear to me if send_user is the same as puts. Every time I want to send an informative message to the user, I would wonder which one I should use. From Expect's man page, it seems like ...
27
votes
10
answers
24k
views
Do a tail -F until matching a pattern
I want to do a tail -F on a file until matching a pattern. I found a way using awk, but IMHO my command is not really clean. The problem is that I need to do it in only one line, because of some ...
27
votes
7
answers
115k
views
TCL remove an element from a list
How te remove an element from TCL list say:
which has index = 4
which has value = "aa"
I have Googled and have not found any built-in function yet.
27
votes
3
answers
7k
views
How to get Command history by cursor key in Linux tclsh
Can get the command history by using cursor key (like up arrow key) in TCL shell (tclsh).
I am running tclsh on fedora with linux version 2.6.21.
25
votes
5
answers
13k
views
Python embeddable zip: install Tkinter
Python embeddable zip comes without pip and Tkinter.
It is easy to install pip with get-pip.py in the embeddable zip.
How can we install Tkinter too (assuming we do not have an existing Python ...
25
votes
3
answers
5k
views
How do I link the ActiveState distribution of Tcl/Tk to HomeBrew installed Python
I am using macOS 10.12.1 Sierra. I am using Python 2.7.12 installed with
brew install python
but the IDLE gives the warning
WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
Visit http:...
25
votes
1
answer
6k
views
How to update Tcl/Tk in Python?
Tcl and Tk in their version 8.6 have been out now for about six weeks. However, the files that can be downloaded from Tcl have a different folder structure and lack some files such as tk85.lib (or ...
23
votes
4
answers
6k
views
Why is modulus different in different programming languages?
Perl
print 2 % -18;
-->
-16
Tcl
puts [expr {2 % -18}]
-->
-16
but VBScript
wscript.echo 2 mod -18
-->
2
Why the difference?
23
votes
4
answers
25k
views
Understanding the usage of braces
I'm learning Tcl/Tk and am confused on the usage of curly braces in tcl.
To me it seems to be used to both indicate scope and declare strings! Is this a bug (or feature)?
Is my interpretation ...
23
votes
2
answers
9k
views
The Simplest Steps to Converting TCL TK to a Stand Alone Application
After running into major compatitiblity problems with C#, ASP.NET, MS Access, Linux, and Mono, I've decided to program in a language that is cross-platform, open source, and compatible with embedded ...
22
votes
3
answers
42k
views
How to concisely concatenate strings in Tcl?
I can easily concatenate two variables, foo and bar, as follows in Tcl: "${foo}${bar}".
However, if I don't want to put an intermediate result into a variable, how can I easily concatenate the ...
22
votes
4
answers
18k
views
What is the difference between spawn and exec?
I'm learning to write a TCL (expect) scripts and I notice that some examples show to use spawn, while others show the command exec. I tried googling, but can't find what is the difference?
Suppose I ...
22
votes
6
answers
38k
views
Install tkinter in python3.6 on Ubuntu [duplicate]
+--------+-----------------------------------+
| OS | Ubuntu 12.04 |
+--------+-----------------------------------+
| Python | 2.7, 3.2 and source installed 3.6 |
+--------+---...
21
votes
6
answers
70k
views
TCL : Concatenate a variable and a string
Assume we have a variable 'a' set to 12345 :
set a 12345
Now how do i set a new variable 'b' which contains the value of 'a' and another string say 9876
workaround is something like
set a "12345"
...
21
votes
2
answers
17k
views
Threads and tkinter
I've heard that threads in Python are not easy to handle and they become more tangled with tkinter.
I have the following problem. I have two classes, one for the GUI and another for an infinite ...
20
votes
4
answers
33k
views
General string quoting for TCL
I'm writing a utility (which happens to be in python) which is generating output in the form of a TCL script. Given some arbitrary string variable (not unicode) in the python, I want to produce a TCL ...
19
votes
5
answers
40k
views
How to get path of current script?
Sometimes its needed to get current path of a script. What are the ways to do that?
19
votes
8
answers
26k
views
IDLE warns against an old TCL version even though I've installed a newer version
I have installed ActiveTcl8.6.1.1.297588-macosx10.5-i386-x86_64-threaded on my OS X 10.9.1 . However, when I launch IDLE by running idle3 from the terminal, the following warning shows in the IDLE ...
18
votes
11
answers
5k
views
Hidden Features of TCL/TK [closed]
I've been working with TCL/TK ,recently started to use TCL/TK with my automation applications and I'm hungry for knowledge.
To continue with the long line of Hidden Feature questions, I would like to ...
18
votes
4
answers
41k
views
How to run tcl script inside other tcl script?
I have two tcl scripts. I want to run the second script when the first finished. How can I do it?
18
votes
3
answers
14k
views
Know any creative ways to interface Python with Tcl?
Here's the situation. The company I work for has quite a bit of existing Tcl code, but some of them want to start using python. It would nice to be able to reuse some of the existing Tcl code, ...
18
votes
1
answer
34k
views
How to get the results (standard output) of a TCL exec command?
Say I have a TCL script like this:
exec ls -l
Now this will print out the content of current directory. I need to take that output as a string and parse it. How I can do this?
17
votes
4
answers
6k
views
Why are multiple instances of Tk discouraged?
Consider below example:
import tkinter as tk
root = tk.Tk()
root.title("root")
other_window = tk.Tk()
other_window.title("other_window")
root.mainloop()
and also see below example that creates ...
17
votes
3
answers
10k
views
TCL obtain the proc name in which I am
How to know what is the name of the proc in which I am. I mean I need this:
proc nameOfTheProc {} {
#a lot of code here
puts "ERROR: You are using 'nameOfTheProc' proc wrongly"
}
so I want ...
17
votes
2
answers
10k
views
Should I use Perl/Tk, Tcl::Tk or Tkx for a Perl GUI?
I really like Perl/Tk, but have come to the opinion that it's DOA. I think Tcl::Tk and Tkx are better solutions. Assume I drop Perl/Tk. Is the "most supported" route to go with Tcl::Tk (which hasn't ...
16
votes
5
answers
19k
views
Fullpath of current TCL script
Is there a possibility to get the full path of the currently executing TCL script?
In PHP it would be: __FILE__
16
votes
4
answers
19k
views
Neatly listing values in multiple lines
How does one list values in multiple lines without a backslash at the end of each line?
One can't create a list in multiple lines without having a backslash at the end.
For example, the following (...
16
votes
1
answer
37k
views
How to Print the Contents of an Array in Tcl
I want to print the contents of an array in Tcl (for debugging). The order is unimportant, I just want every value printed.
How do I do it?
16
votes
1
answer
11k
views
How do I remove a Tcl procedure?
How do I remove a tcl procedure?
One can
unset a variable,
override an alias with interp alias {} myproc {} otherproc,
override a proc with one defined inside another namespace with namespace ...
16
votes
3
answers
30k
views
Passing list to Tcl procedure
What is the canonical way to pass a list to a Tcl procedure?
I'd really like it if I could get it so that a list is automatically expanded into a variable number of arguments.
So that something like:...
15
votes
4
answers
89k
views
the if statement in TCL
I have a question about if statement in tcl of the following code:
if {(($number == 1)&&($name == "hello")) || (($number == 0)&&($name == "yes"))} {
#do something here
}
The ...
15
votes
2
answers
11k
views
Background spawned process in Expect
I'm using expect to start an application on my server:
#!/usr/bin/expect
set timeout -1
spawn "bin/start-all.sh"
expect {
-re "Found MongoDB in" { send "y\r"; exp_continue }
-re "Found ...
14
votes
9
answers
65k
views
Python tcl is not installed properly
I just installed graphics.py for python.
But when I tried to run the following code:
from graphics import *
def main():
win = GraphWin("My Circle", 100, 100)
c = Circle(...
13
votes
6
answers
13k
views
TCL vs Lua - scripting a mmo server
I have a c++ server side project that I need to embed some sort of scripting into. It is part of an online MMO type of server. I have significant experience using TCL, and it seems like the natural ...
13
votes
6
answers
44k
views
Determine type of a variable in Tcl
I'm looking for a way to find the type of a variable in Tcl. For example if I have the variable $a and I want to know whether it is an integer.
I have been using the following so far:
if {[...
13
votes
4
answers
15k
views
Tcl/Tk examples?
Tcl/Tk is a simple way to script small GUIs.
Can anyone give a nice example with a button and a text widget. When the button is pressed should a shell command be executed and the output piped to the ...
13
votes
1
answer
19k
views
Expect - Interrupt program - Ctrl+C
I am running the following script to start a capture on a remote server and download the file afterwards. Currently I have to pause it with Ctrl+C and manually exit.
How can I replace the interact ...
13
votes
4
answers
31k
views
how the upvar command works in TCL?
I have a question about upvar command in TCL. Using upvar command, we have have a reference to a global variable or a local variable in other procedure. I saw the following code:
proc tamp {name1 ...
13
votes
5
answers
18k
views
Install tkinter and python locally
I work with linux on a servies. And I don't have the root privilege. I installed the python-3.2.3 locally to "/home/sam/install_sam". when I import the tkinter module. I get the following error:
...