vlsimpson has asked for the wisdom of the Perl Monks concerning the following question:

I am in the process of moving a Perl/Tk text editor to Perl/Tkx.

The following code works fine on Windows XP ActivePerl 5.8/5.10 but my OS X testers are getting this error:

invalid command name "tk::text" at tkx-test-1.pl line 24. (There's a FIXME: on the offending line.)

I've searched on this but no results that seemed applicable.

Thanks for any and all responses.

use warnings; use strict; use Tkx; my $VERSION = "1.0.0"; my ($mw, $tw); $mw = Tkx::widget->new("."); $tw = $mw->new_tk__text( # FIXME: Barfs on OS X -width => 40, -height => 10 ); $tw->g_grid; $tw->g_focus; $tw->insert("1.0", "If you can read this it worked."); Tkx::MainLoop(); exit;

Replies are listed 'Best First'.
Re: Tkx: "invalid command error" OS X
by jand (Friar) on Nov 20, 2008 at 02:13 UTC
    tk::text is a themed widget new in Tcl/Tk 8.5, so I assume you are still using 8.4 on OS X. This happens when you are either using an older version of ActivePerl on the Mac, or if you use the default versions of Perl and Tcl supplied by Apple.

    If you are stuck using 8.4 then you could change your code to call $tw = $mw->new_text(...); which uses the old name and should work with both 8.4 and 8.5.

      Thanks, jand. That was it, 8.4 vs. 8.5

      Thanks also, almut, for the TRACE pointer.

Re: Tkx: "invalid command error" OS X
by almut (Canon) on Nov 19, 2008 at 21:58 UTC
    invalid command name "tk::text"

    The message is issued by the Tcl interpreter, so maybe your Tcl/Tk isn't installed properly... (packages missing, or some such)

    Enabling debugging might also shed some light on what's going on:

    "If the boolean variable $Tkx::TRACE is set to a true value, then a trace of all commands passed to Tcl will be printed on STDERR. This variable is initialized from the PERL_TKX_TRACE environment variable. The trace is useful for debugging and if you need to report errors to the Tcl maintainers in terms of Tcl statements."