2013-11-14 164 views
4

我試圖在Windows7上安裝TkTreectrl而沒有成功。 我下載瞭解壓縮版本2.0.1的包,並嘗試運行setup.py。那個人首先總是抱怨文件夾TkTreectrl不存在,這是錯誤的,因爲該文件夾與下載並且我正在TkTreectrl所在的同一目錄中運行setup.py。在Windows上安裝TkinterTreectrl

根據自述文件還有另一個選項來安裝,這將是將TkTreectrl文件夾複製到site-packages目錄中。所以,我這樣做了,沒有任何改變。然後我再次運行setup.py,它沒有抱怨缺少TkTreectrl文件夾。

然而,

from Tkinter import * 
import TkTreectrl as Tktree 
root = Tk() 
t=Tktree.Treectrl(root, width=20, height=20).pack() 
root.mainloop() 

回來與錯誤消息:

版本= master.tk.call( '包', '需要', 'TREECTRL') _tkinter.TclError:可以找到包treectrl

有人能告訴我我的錯誤在哪裏嗎?

乾杯

回答

0

那麼TK是一個完全不同的語言本身。該小部件應該有一個文件來管理該小部件的所有內容。所有的python都解釋了這一點,只允許我們在tkinter中使用它。所以機率是你沒有文件,或者如果你這樣做是錯誤的地方。

0

爲了使用TKTreectrl,您還需要安裝Tcl/Tk treectrl軟件包。

http://tkintertreectrl.sourceforge.net/下安裝:

Of course you will also have to install the Tcl/Tk treectrl package to be able to use the TkTreectrl module.

On windows systems simply download the tktreectrl-2.x.x-Tk8.x-win32.zip archive suitable for the Tk version in use and copy the contents of the archive into your Python installation's tcl folder.

On unix systems you will probably have to compile the treectrl package from the sources. To do so, download and unpack the latest tktreectrl-2.x.x.tar.gz archive, cd into the tktreectrl-2.x.x directory and type (as root)

./configure && make && make install 

If this fails it is most likely because configure cannot find the Tcl installation. In this case (or if you have multiple versions of Tcl/Tk installed) you have to pass the paths to the tclConfig.sh and tkConfig.sh to configure , as for example:

./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4 
make 
make install