in reply to Re^2: Error Not a tk object / Problems with multiple files
in thread Error Not a tk object / Problems with multiple files
The first MainWindow you declare is fine, but all those following ones should be converted to Toplevel windows, which exist under the the single MainLoop of the first MainWindow declared.
Here is a simple usage of Toplevel
#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->Label(-text => 'Main Window')->pack; $mw->Button( -text => 'Quit Main', -command => sub{$mw->destroy}, )->pack; my $top = $mw->Toplevel; $top->Label(-text => 'Top level Window')->pack; $top->Button( -text => 'Exit Top level', -command => sub{$top->destroy}, )->pack; $top->transient($mw); MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Error Not a tk object / Problems with multiple files
by reaper9187 (Scribe) on Oct 16, 2012 at 12:03 UTC | |
by zentara (Cardinal) on Oct 16, 2012 at 12:14 UTC | |
by reaper9187 (Scribe) on Oct 16, 2012 at 12:50 UTC |