in reply to TKX and closing windows

http://stackoverflow.com/questions/4373119/how-can-i-repeatedly-prompt-the-user-with-tkx says don't g_destroy but g_wm_withdraw instead

Replies are listed 'Best First'.
Re^2: TKX and closing windows
by x-lours (Sexton) on Jun 03, 2013 at 09:40 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

        Thanks a lot for this explanation. i have to pass to Tk then.
        juste a last question : why is it impossible to create a new Tcl Interpreter with tkx ?