in reply to Re^2: TKX and closing windows
in thread TKX and closing windows

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

Replies are listed 'Best First'.
Re^4: TKX and closing windows (bug)
by x-lours (Sexton) on Jun 03, 2013 at 11:42 UTC
    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 ?
      look inside and you'll know