tcl

tcl/tk编译

天大地大妈咪最大 提交于 2020-01-12 19:05:23
参考: http://www.tcl.tk/doc/howto/compile.html#win 可下载已编译好的bin版本: https://bitbucket.org/tombert/tcltk/downloads/ 1.下载tcl-tk库 http://www.tcl-lang.org/ https://nchc.dl.sourceforge.net/project/tcl/Tcl/8.6.10/tcl8610-src.zip https://nchc.dl.sourceforge.net/project/tcl/Tcl/8.6.10/tcl8610-src.zip 2. 将下载后的文件解压到如下目录 E:\osg\tcl-tk\tcl8.6.10 与 E:\osg\tcl-tk\tk8.6.10 并创建如下目录: E:\osg\tcl-tk\tcltk 3. 编译 打开X64 Native Tools Command Prompt for VS 2019程序 3.1 TCL cd E:\osg\tcl-tk\tcl8.6.10\win nmake -f makefile.vc INSTALLDIR=E:/osg/tcl-tk/tcltk nmake -f makefile.vc install INSTALLDIR=E:/osg/tcl-tk/tcltk 3.2 TK cd

How to set border color of certain Tkinter widgets?

◇◆丶佛笑我妖孽 提交于 2020-01-12 03:06:30
问题 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() root.config(bg=COLOR) button = Button(text="button", bg=COLOR) button.pack(padx=5, pady=5) entry = Entry(bg=COLOR, fg='white') entry.pack(padx=5, pady=5) text = Text(bg=COLOR, fg='white') text.pack(padx=5, pady=5) root.mainloop() How can I set border colour of certain Tkinter widgets? 回答1: Just use

linux上安装tcl

两盒软妹~` 提交于 2020-01-11 15:45:58
1. 首先下载安装包,推荐下载activetcl(对tcl源码进行了预编译,安装步骤简单)。打开网址http://activestate.com找到activetcl的社区版(社区版是免费的,找到linux平台下的.tar.gz包,直接点download就可以下载。我下载的是8.6.4版本的ActiveTcl8.6.4.1.299124-linux-x86_64-threaded.tar.gz) 2. 用tar -zxvf ActiveTcl8.6.4.1.299124-linux-x86_64-threaded.tar.gz命令解压安装包以后会得到文件ActiveTcl8.6.4.1.299124-linux-x86_64-threaded,打开此文件可以看到里面有一堆install文件,其中有一个叫install.sh的文件。 3. 运行install.sh文件,命令为./install.sh。(tips:如果之前没有linux基础的童鞋,可以参考下我下面的操作,如果有的话就略过,直接到第4步。我下载的安装包是放在/home/flyer/packages文件下的)。 完整的linux操作为: cd /home/flyer/packages tar -zxvf ActiveTcl8.6.4.1.299124-linux-x86_64-threaded.tar.gz cd

Tcl equivalent for UNIX “cp -pL” command

落爺英雄遲暮 提交于 2020-01-11 11:09:12
问题 What is Tcl equivalent for UNIX "cp -pL" command? I cannot find it in file command description 回答1: For a single file: a) Get the real path to the file. b) Copy it. c) Set the attributes, modification time and access time. Unfortunately, there does not appear to be any way to set the change time (creation time on Windows). set fn sourcefn set tofn targetfn set nfn [file normalize [file readlink $fn]] file copy -force $nfn $tofn foreach {key} [list attributes mtime atime] { set temp [file $key

Tcl equivalent for UNIX “cp -pL” command

不想你离开。 提交于 2020-01-11 11:09:11
问题 What is Tcl equivalent for UNIX "cp -pL" command? I cannot find it in file command description 回答1: For a single file: a) Get the real path to the file. b) Copy it. c) Set the attributes, modification time and access time. Unfortunately, there does not appear to be any way to set the change time (creation time on Windows). set fn sourcefn set tofn targetfn set nfn [file normalize [file readlink $fn]] file copy -force $nfn $tofn foreach {key} [list attributes mtime atime] { set temp [file $key

Tcl equivalent for UNIX “cp -pL” command

為{幸葍}努か 提交于 2020-01-11 11:09:11
问题 What is Tcl equivalent for UNIX "cp -pL" command? I cannot find it in file command description 回答1: For a single file: a) Get the real path to the file. b) Copy it. c) Set the attributes, modification time and access time. Unfortunately, there does not appear to be any way to set the change time (creation time on Windows). set fn sourcefn set tofn targetfn set nfn [file normalize [file readlink $fn]] file copy -force $nfn $tofn foreach {key} [list attributes mtime atime] { set temp [file $key

Tcl_AsyncDelete Error Multithreading Python

安稳与你 提交于 2020-01-11 10:37:11
问题 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 process (I MUST use classes for both). First, I start the GUI class and then the infinite process' class. I want that when you close the GUI, it also finishes the infinite process and the program ends. A simplified version of the code is the following: import time, threading from tkinter import * from

How to test a Tcl/Tk script?

扶醉桌前 提交于 2020-01-11 03:13:19
问题 We have a few Tcl/Tk scripts (because a GUI we use can incorporate macros only in Tcl). I have just modified one of these, and want to test it. We make use of Test::More for testing Perl modules, and have made a little use of Selenium for web pages, but we have never had any kind of automatic test rig for our Tcl/Tk scripts. I've tried searching, but because Tcl's original purpose was for testing, I've found it difficult to sort out if there are any hits about testing Tcl/Tk itself. Does

用Tcl/Tk脚本计算圆周率

你说的曾经没有我的故事 提交于 2020-01-09 17:29:37
读了阮一峰的 蒙特卡罗方法入门 ,用概率统计的方式求解棘手的数学问题还挺有意思的,尤其是利用正方形和它的内切圆之间的面积关系来建模求解圆周率的方法精巧又简单,比投针实验好理解也好实现多了。建模可不是Matlab或者MAST/VHDL语言的专利,既然tcl/tk语言也有内置的随机数产成函数 rand() ,那么我用tcl/tk建模计算圆周率也应该不在话下。 建模思想 正方形的内切圆与该正方形的面积之比是π/4。 图片和公式引用自阮一峰的 蒙特卡罗方法入门 在这个正方形内部,随机产生足够多的点,计算它们与中心点的距离,判断是否落在圆的内部。如果这些点均匀分布,那么圆内的点应该占到所有点的 π/4,因此将这个比值乘以4,就是π的值。 脚本实现 tcl/tk内置math函数库的rand()方法可以随机生成0~1的浮点数,假设圆的半径为整数r,可以用以下方式产生(0,r)区间的随机整数: set value [ int [ expr rand () * $r ]] 为了计算简便,可以把模型进一步简化,只计算第一象限内的点落入圆内的比例。为了观察tcl/tk的 rand() 函数是否真的随机,我又多加了几行tk代码,把所有的点都显示出来。下面的代码中正方形的边长为300,随机产生300*300个点,理想情况下如果随机点100%均匀分布,那么每个点应该恰好对应一个像素,画布会一片漆黑。 tcl

Script to generate N number of valid ip addresses?

倾然丶 夕夏残阳落幕 提交于 2020-01-07 05:53:05
问题 I am new to TCL and trying to learn by doing some simple scripting, I have taken upon to write a simple script which generates valid ip address from a given starting ip address. I have managed to write one but have run into two problems, The last octet has a zero getting added in front of the number that is 192.168.1.025 When i specify the starting ip something like this 250.250.5.1 it fails to generate proper ips, Below is my code: proc generate {start_addr total_addr} { if {$total_addr == 0