Sylvain Thibault wrote:
Sylvain Thibault wrote:
I am using Tkx with ActivePerl 5.10 and tkkit.dll on Windows XP.  I
want to use the package img::jpeg but tkkit only has PNG, ICO and XPM
support.  How do I add the Img package (or any package) so that it is
accessible to Tkx.  The Img package is in Tk85.dll.  I have tried
Tkx::lappend('::auto_path', 'C:/Tcl/bin')  C:/Tcl/bin/tk85.dll and
quite a few other combination with no success.
        ...
You want to lappend to ::auto_path as shown above, but 'C:/Tcl/lib' is the place to add. There is a way to extend the tkkit with additional modules as well if you are familiar with Tcl's core virtual file system APIs (needs to be done from a Tcl interpreter). I should add this info to the tkkit docs.

I must be missing something.

Tkx::lappend('::auto_path', 'C:/Tcl/lib/');

 DB<2> print join "\n", (Tkx::SplitList(Tkx::set('auto_path')));
C:/Perl10/lib/auto/Tcl/tkkit.dll/lib/tcl8.5
C:/Perl10/lib/auto/Tcl/tkkit.dll/lib
C:/Perl10/lib/auto/Tcl/tkkit.dll/lib/tk8.5
C:/Perl10/lib/auto/Tcl/tkkit.dll/lib/tk8.5/ttk
C:/Tcl/lib/

Tkx::package_require('img::png');
Tkx::package_require('img::jpeg');

can't find package img::jpeg at test.pl line 61.
at c:/Perl10/lib/Tkx.pm line 330
Tkx::i::call('package', 'require', 'img::jpeg') called at c:/Perl10/lib/Tkx.pm line 51
Tkx::AUTOLOAD('img::jpeg') called at test.pl line 61

Tkx::package_require('Img") fails also.

C:/Tcl is the ActiveTcl 8.5.4 install directory.

OK, you are right and the issue is that things became a bit more complex with the ActiveTcl 8.5 release. We moved to a teapot-based install that obfuscates the exact location. You can see the full set of locations with "puts [join $::auto_path \n]" in a tclsh85 shell.

In any case, as I look at the latest tkkits, I see that for some silly reason it has all the necessary binaries embedded, it just simply lacks the registering of those packages via pkgIndex.tcl. Here is a simple script that will add img::jpeg (and other formats) to the tkkit. Run with tclsh85. There should be no line breaks in the code. The same could run on any platform, but you'd have to point to the right tkkit and use the .so instead of .dll library names.

Jeff

##################################
package require vfs
set tkkit "C:/Perl10/lib/auto/Tcl/tkkit.dll" ; # set to correct path
file attributes $tkkit -readonly 0 ; # needs to be writable
vfs::mk4::Mount $tkkit tkkit ; # mounts file as dir 'tkkit'
set pkg tkkit/lib/Img1.3/pkgIndex.tcl
set fid [open $pkg w]
puts $fid {# Img package bits
package ifneeded pngtcl 1.2.24 [list load $dir/pngtcl1224.dll]
package ifneeded zlibtcl 1.2.3 [list load $dir/zlibtcl123.dll]
package ifneeded tifftcl 3.8.2 [list load $dir/tifftcl382.dll]
package ifneeded jpegtcl 1.0 [list load $dir/jpegtcl10.dll]
package ifneeded img::bmp 1.3 [list load $dir/tkimgbmp13.dll]
package ifneeded img::gif 1.3 [list load $dir/tkimggif13.dll]
package ifneeded img::ico 1.3 [list load $dir/tkimgico13.dll]
package ifneeded img::jpeg 1.3 [list load $dir/tkimgjpeg13.dll]
package ifneeded img::pcx 1.3 [list load $dir/tkimgpcx13.dll]
package ifneeded img::pixmap 1.3 [list load $dir/tkimgpixmap13.dll]
package ifneeded img::png 1.3 [list load $dir/tkimgpng13.dll]
package ifneeded img::ppm 1.3 [list load $dir/tkimgppm13.dll]
package ifneeded img::ps 1.3 [list load $dir/tkimgps13.dll]
package ifneeded img::sgi 1.3 [list load $dir/tkimgsgi13.dll]
package ifneeded img::sun 1.3 [list load $dir/tkimgsun13.dll]
package ifneeded img::tga 1.3 [list load $dir/tkimgtga13.dll]
package ifneeded img::tiff 1.3 [list load $dir/tkimgtiff13.dll]
package ifneeded img::window 1.3 [list load $dir/tkimgwindow13.dll]
package ifneeded img::xbm 1.3 [list load $dir/tkimgxbm13.dll]
package ifneeded img::xpm 1.3 [list load $dir/tkimgxpm13.dll]
}
close $fid
vfs::unmount tkkit
exit
###################################

Reply via email to