Zac
Zac

Reputation: 109

Running a Tcl script opens a blank window

I have a tcl script that I wrote called perm.tcl I'm trying to run this script on a windows machine.

package require Tk

proc invert list {
  set length [llength $list]
  return $length
}

invert {1 2 3 4}

Whenever i try to run this code in a command prompt using

tclsh perm.tcl

a blank activetcl window opens titled "perm" with no text or anything. In this case it should simply output the number 4 but im getting just a small greyed out window. I know this procedure works because when i painstakingly write it out in the tclsh command prompt i get the desired result of 4. Please help

Upvotes: 0

Views: 459

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385900

It is because you are importing the Tk package. When you do that, it automatically creates a window. If you don't want any windows, don't import Tk.

Upvotes: 1

Related Questions