开发者

package require Tk - not working in tclsh

开发者 https://www.devze.com 2023-02-15 11:17 出处:网络
I am trying to load Tk package in tclsh but I am not able to load it. After googling, I figured that modifying auto_path might help. But unfortunately it did not help me.

I am trying to load Tk package in tclsh but I am not able to load it. After googling, I figured that modifying auto_path might help. But unfortunately it did not help me.

In my Linux machine I can run tclsh and wish and both are v8.3; The following is what I tried on tclsh and wish:

% tclsh
% package require Tk
can't find package Tk
% puts $auto_path
/usr/share/tcl8.3 /usr/share /usr/lib
% 

% wish
% puts $auto_path
/usr/share/tcl8.3 /usr/share /usr/lib /usr/share/tk8.3
% 

% tclsh
% lappend auto_path /usr/share/tk8.3
/usr/share/tcl8.3 /usr/share /usr/lib /usr/share/tk8.3
% package require Tk
can't find package Tk
% 

开发者_开发知识库Can someone help me in fixing this problem?

EDIT: I tried the following to get it working. But there must be a better way

% tclsh
% load /usr/lib/libtk8.3.so
% package require Tk
8.3


Loading Tk as a standard package is not supported in 8.3 (which is basically unsupported now anyway; the last 8.3 release was about 10 years ago). Upgrading to 8.5 should make it all work; it might also work in 8.4 (but that's also end-of-lifed now).

(There's a whole bunch of reasons why it didn't work in 8.3; basically, it required extra API functions to be added – done in 8.4 – and it required the build to be done in the right way. That was done in 8.4 too.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号