python调用tcl
① python如何调用含有多个参数的tcl函数
你可以用3个变量去接收返回值,也可以直接获得tuple,然后用数组的索引去获得。比如这样: def returnMulti(): return 1, 2, 3 result = returnMulti()a, b, c = returnMulti()print result[0], result[1], result[2]print a, b, c结果是一样的。
② 安装了python 2.7,IDLE打不开,而且系统环境变量里也没有TCL之类的变量。咋办
默认情况下,Python是不会自动添加到环境变量的,需要自己在Path环境变量中添加Python的安装目录,TCL也是;
至于IDLE不能启动,linux下的Python安装包是不包含IDLE的,Windows下的Python安装有,在开始--》程序--》Python中可以找到快捷方式,打开。
③ 请教一下在windows下,tcl文件如何编译运行,是python.exe abc.tcl吗
我安装了Python
2.5.2,发现里面有目录:C:\Python25\tcl,
是附带了tcl,但里面根本没有tcl的编译器:tclsh
或
wish(我搜索不到文件wish*或者tclsh*)那里面的tcl目录干啥的呢,还请解释一下python和tcl究竟啥关系?为什么带了tcl目录,又没有tcl文件的编译器?[
本帖最后由
yuonunix
于
2008-4-18
17:57
编辑
]
④ 为什么python是用tcl/tk做UI界面的
python是解释性语言,所以也要选一个解释性的界面语言,tk工具包是唯一的选择。
tk工具包比较小巧,只关注界面,不像qt或wx一样还包含很多python已有的内容。
尽可能少的bug。
⑤ python2.7.10 适用哪个版本的tcl插件
不需要安装
1. Hello Tcl!
在Python中使用Tcl,不需要安装任何第三方模块。考虑下面一个简单的程序:
import Tkinterinterp = Tkinter.Tcl()interp.eval('puts "Hello Tcl!"')
我们首先利用TKinter.Tcl()得到一个Tcl解释器对象,然后执行它的eval方法,运行一小段Tcl代码。
然而,如果打算Tcl和Python环境有所交互,eval方法就力不从心了。
⑥ 如何将python程序改为tcl程序
如何将批发the温室重新改为TCL程序证,应该有可能是这个程序因为不支持,所以这两百吧真的生效,所以还是要注意这种方法开高精度的。
⑦ python TclError 是什么意思
from tkinter import *
from tkinter.filedialog import askopenfilename
from PIL import Image,ImageTk
class mainapp:
def __init__(self):
root=Tk()
root.title("Several")
root.geometry('200x300')
Button(root,text='自动取点',command=self.another1).place(relx=0.3,rely=0.15,anchor=CENTER)
Button(root,text='图片翻转').place(relx=0.7,rely=0.15,anchor=CENTER)
root.mainloop()
def another1(self):
qudian()
def another2(self):
fanzhuan
class qudian:
def __init__(self):
r1=Tk()
r1.title('自动取点')
r1.geometry('400x400')
Label(r1,text='图片路径:').place(relx=0,rely=0.04)
e1=Entry(r1)
e1.place(relx=0.15,rely=0.04)
Button(r1,text='选择图片').place(relx=0.52,rely=0.02)
Label(r1,text="所选择的图片:").place(relx=0,rely=0.13)
img_open=Image.open('desert.jpg')
img_open.thumbnail((200,200))
img=ImageTk.PhotoImage(img_open)
l1=Label(r1,image=img)
l1.place(relx=0,rely=0.18)
r1.mainloop()
class fanzhuan:
def __init__(self):
r2=Tk()
r2.mainloop()
mainapp()
⑧ python中如何调用tcl脚本
1.确保perl已经安装并且在PATH中。
2.in python:
import subprocess
subprocess.call(["perl", "/path/to/your-script.pl"])
如果脚本本身有可执行权限,直接这样也行:
import subprocess
subprocess.call(["/path/to/your-script.pl"])
⑨ 如何解决Mac版关于python3.5.X的Tcl/Tk 的警告
ActiveTcl Downloads
从这里下载Tcl试试
下载8.6.4版本还会报错,我又试着装了下8.5.18,重启IDLE便没有提示不稳定了。
而且,也可以打印中文了:
<img src="https://pic2.mg.com/50/_hd.png" data-rawwidth="697" data-rawheight="755" class="origin_image zh-lightbox-thumb" width="697" data-original="https://pic2.mg.com/_r.png">
原因如下(google而来):
Stan W writes (NB. edited for brevity):
Over the last couple of days I have started using your great book with my two sons (13 and 15 years old).I'm reaching out to you with the following question because I have noticed other people asking about the same issue online, withat least one mentioning your book, so I think you posting the question and answer to your blog might help other people in additionto me and my sons.
We are using Mac OSX and have installed Python 3.3.3 from python.org, and are getting this message when opening IDLE:
"WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit IDLE and tkinter with Tcl/Tk on Mac OS X forcurrent information."
I have installed "Mac OS X 64-bit/32-bit Installer (3.3.3) for Mac OS X 10.6 and later" (file: python-3.3.3-macosx10.6.dmg) andinstalled the "ActiveTcl 8.6.1 for Mac OS X (10.5+, x8664/x86)" (file: ActiveTcl8.6.1.1.297588-macosx10.5-i386-x8664-threaded),but IDLE keeps showing the same error message.
Thank you very much for any help you can provide!
I'm not convinced ActiveTcl 8.6.1 is the right version to install - I suspect rather than installing the latest and greatest, you should be using version 8.5.15.0. Python (and thus IDLE) will probably be using the latest 8.5 version of Tcl/Tk (i.e. 8.5.x) — you're installing a completely different version (8.6), which it's not looking for at all. Hence even though you think you've re-installed, you'll still be getting the same error message.
Hope that helps.
⑩ 如何将python中的tcl版本降到8.4
降级是没有办法的,只能是安装旧的版本,或者是另外安装
初学Python,感觉什么都不会。在Linux下安装了一个python1.5.2(随便装的一个版本,现在都有2.6了)
前几天在交互式环境下练习了一下基本的语句。发现有些东西要用到Tck/tk的图形功能。就下了个Tcl8.4.13和tl8.4.14。安装之后发现编译用到Tcl/tk之类的东西的时候就提示:
No mole named _tkinter
尝试import Tkinter出现同样的错误。
整了半天没找到原因在哪里,网上索罗看到一些需要-dev..什么的。因为对linux不熟悉,刚用没几天。很多东西看不明白。有些解释太过专业。我这个新手貌似还跟不上。
后来看到一些people说需要先装Tcl/tk,然后修改python的setup.dist文件的一些东西(主要是注释项 )再装python
于是打算准备把python又装一遍
用find命令在我的python文件包里没有找到Setup.dist.只有Setup,Setup.in,Setup.local应该是版本不同的原因吧。这几个文件里的内容都差不多,但是具体每个的用途当时没有明白。
尝试修改Setup文件里的这一段的内容:
# *** Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
-I/usr/local/include \
......
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
-L/usr/local/lib \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
-ltk8.4 -ltcl8.4 \
......
# *** Always uncomment this; X11 libraries to link with:
-lX11
最后安装python
./configure
make
make install
终于成功了。
教训是深刻的,在这个上面浪费了一大堆的时间。其实在python 的README文件里面说的很清楚。包括Setup,Setup.o的作用等等。安装Tcl/tk需要修改的选项之类的其实注释的蛮清楚的。
所以安装的时候看看帮助文件是很必要的。
还有就是搜索问题的时候应该多一些条理,不能蒙头就搜。