Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Open a file using Tkx package

by Gangabass (Vicar)
on Nov 19, 2011 at 13:28 UTC ( #938971=note: print w/replies, xml ) Need Help??

in reply to Open a file using Tkx package

my $btn_source_file = $mw->new_tk__button( -text => "Choose...", -command => sub { get_source_filename(); } ); sub get_source_filename { $source_file = Tkx::tk___getOpenFile(); }

Replies are listed 'Best First'.
Re^2: Open a file using Tkx package
by bugged123 (Initiate) on Nov 21, 2011 at 18:41 UTC
    Hi I tried that I am still not able to run it. Here's what I did. I am using active perl 5.14 Thanks
    use strict; use Tkx; use constant TRUE => 1; use constant FALSE => 0; #Defining UI components. our $iteration = 0; our $mw = Tkx::widget->new("."); $mw->g_wm_title("G7 Fiery."); $mw->g_wm_minsize(300, 300); #our $filename = Tkx::tk__getOpenFile(); our $frame = $mw->new_ttk__frame( -padding => "3 3 12 12"); our $label1 = $mw->new_ttk__label(-text => "Iteration"); our $label2 = $mw->new_ttk__label(-textvariable => \$iteration); our $cb = $frame->new_ttk__button(-text => "Calculate", -command => su +b {calculate();}); our $cb1 = $frame->new_ttk__button(-text => "open", -command => sub {g +et_source_filename();}); #Placing objects . $frame->g_grid(-column => 0, -row => 0, -sticky => "nwes"); $cb->g_grid(-column => 3, -row => 3, -sticky => "w"); $cb1->g_grid(-column => 2, -row => 3, -sticky => "e"); $label1->g_grid(-column => 2, -row => 1, -sticky => "w"); $label2->g_grid(-column => 3, -row => 1, -sticky => "w"); $mw->g_grid_columnconfigure(0, -weight => 1); $mw->g_grid_rowconfigure(0, -weight => 1); foreach (Tkx::SplitList($frame->g_winfo_children)) { Tkx::grid_configure($_, -padx => 5, -pady => 5); } sub calculate() { $iteration ++; } sub get_source_filename { $source_file = Tkx::tk___getOpenFile(); } Tkx::MainLoop;

      $ perl junk Global symbol "$source_file" requires explicit package name at junk li +ne 35. Execution of junk aborted due to compilation errors.

      It works for me every time

      $ perl -MTkx -e " print Tkx::tk___getOpenFile() " C:/dev/temp/junk
        Thanks !!! That helped a lot !! A big thank you...
        Thank you !!! This helped a lot. Declared the $filename as our and the problem got solved.
      Uncommenting the line $source_file = Tkx::tk___getOpenFile(); and it runs.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938971]
[marto]: Wolfsbane , now I'm having flashbacks
[choroba]: Isn't Using PerlPod Creatively rather a meditation?
[choroba]: I don't see a question
[1nickt]: ugh, I stuck my head in the bass bin for 30 seconds on a dare at Ted Nugent at Hammersmith Odeon. Yes, I am 40% deaf now.
[johngg]: My daughter is incredibly jealous of my wife who got to see The Clash at Brixton many years ago. They went to see The Vaccines there recently.
[1nickt]: But the bands are even louder! I saw Spearhead (Michael Franti) at an outdoor show and had to walk a mile away to not feel pain in my chest! Babies were crying ... I asked the sound engineer why it was necessary to have the bass so loud and he laughed...
[Discipulus]: but the best i attended live was Mano Negra Patchanka at Forte Prenestino .. in 1990
[Corion]: Hmmm - Mano Negra or at least Manu Chao seem to put on a good live show. At least the one live CD I have from Manu Chao sounds good ;)
Discipulus feels the same jealousity of the johngg's daughter
[1nickt]: choroba I agree

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-03-24 12:15 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (301 votes). Check out past polls.