x-lours has asked for the wisdom of the Perl Monks concerning the following question:

Hello

I have a script which use a Tkx window to collect parameters from the user and some useful shortcut of Tkx ( Tkx::tk___chooseDirectory , Tkx::tk___messageBox )

The problem is that when i close the window (with $mw->g_destroy) then i can't use the shortcut of Tkx any more. i have the message
can't invoke "tk_chooseDirectory" command:  application has been destroyed at lancer_PMEP_version15-v3.pl line 113.
But i need to use some Tkx shortcuts after the closing of the window.

Have any one an idea of a command or a way to reactivate the shorcuts of Tkx after a $mw->g_destroy ?

thanks for answering

Replies are listed 'Best First'.
Re: TKX and closing windows
by Anonymous Monk on May 24, 2013 at 18:55 UTC
      i try it, it works but to fine : i loose the next window !
      the Tkx shortcut doesn't be shown.
      is it a question of focus or a question of what ?
      thanks for any help

        Its a tkx bug plain and simple

        See Tcl::Tk, this works

        #!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); sub Main { Fudge(); Fudge(); } sub Fudge { use Tcl::Tk; my $int = new Tcl::Tk; my $mw = $int->mainwindow; my $lab = $mw->Label(-text => "Hello world")->pack; my $btn = $mw->Button(-text => "test", -command => sub { $lab->configure(-text=>"[". $lab->cget('-text')."]"); })->pack; $int->MainLoop; }

        Why this works? Because each $int Tcl::Tk is a new Tcl interpreter

        Why the same doesn't work with Tkx? Because Tkx creates a single Tcl interpreter, and when it ends, that's it, it ends

        You can patch Tkx.pm, its pure-perl, but this is a bug in Tkx