當前位置:首頁 » 編程語言 » python調用tcl

python調用tcl

發布時間: 2022-04-23 05:24:54

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界面的

  1. python是解釋性語言,所以也要選一個解釋性的界面語言,tk工具包是唯一的選擇。

  2. tk工具包比較小巧,只關注界面,不像qt或wx一樣還包含很多python已有的內容。

  3. 盡可能少的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需要修改的選項之類的其實注釋的蠻清楚的。
所以安裝的時候看看幫助文件是很必要的。
還有就是搜索問題的時候應該多一些條理,不能蒙頭就搜。

熱點內容
資料庫系統的例子 發布:2025-05-18 03:02:42 瀏覽:191
數字化儲存與編譯是什麼 發布:2025-05-18 02:56:55 瀏覽:217
個人網站模板源碼 發布:2025-05-18 02:51:17 瀏覽:490
主伺服器ip地址 發布:2025-05-18 02:46:29 瀏覽:856
電腦配置太低玩不了絕地求生怎麼辦 發布:2025-05-18 02:38:39 瀏覽:797
存儲過程怎麼出錯了 發布:2025-05-18 02:37:16 瀏覽:368
32寸演算法 發布:2025-05-18 02:22:14 瀏覽:744
寶塔資料庫備份 發布:2025-05-18 02:14:18 瀏覽:192
安卓商店下載的光遇是什麼服 發布:2025-05-18 02:13:38 瀏覽:31
網頁挖礦源碼 發布:2025-05-18 02:13:34 瀏覽:307