I have a TK program and need to share my MainWindow across packages. Please enlighten me on how I can do this.
# my main program
Now I have another file that I want to be able to use $MW in to be the parent of my dialog box.use strict; use warnings; use Tk; our $MW = MainWindow->new(%{$BPP::BPPDEFAULTS::MYDEFAULTS{MAINWINDOW}} +); $MW->geometry('800x700+0+0'); ...
use Tk::Dialogbox; package BPP::ABOUT; sub AboutBPP { my $about_dialog = $MW->DialogBox( -title=>'About BPP', -background=>'#ffffcc', -buttons=>["Ok"],); my $pic = $about_dialog->Photo(-file=>'money.gif'); $about_dialog->add('Label', -image=>$pic,-background=>'#ffffcc' ) +->grid(-row=>0, -column=>0,-sticky=>'w'); $about_dialog->Show; }#end AboutBPP 1
Update
Here is the error message i'm getting:
THANKS!Tk::Error: Can't call method "DialogBox" on an undefined value at BPP/ +ABOUT.pm l ine 14. (menu invoke)
In reply to Sharing Across Packages by mikasue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |