in reply to Question on Tk Entry

The following seems to work for me -- even though I left out important things like "use strict;" (I wanted to make a worst-case scenario ;^). So the trick for you is to figure out what you're doing that's different.

This is the whole program: it puts up an Entry and a Button; when you push the button, it prints whatever is in the entry at that moment. See if it does that for you.

use Tk; $main=MainWindow->new(); $main->Entry(-width => 20, -textvariable => \$regex, )->pack(); $main->Button(-text=>"Print me", -command => sub{ print "$regex\n" } )->pack(); MainLoop;

Replies are listed 'Best First'.
Re: Re: Question on Tk Entry
by Popcorn Dave (Abbot) on Apr 22, 2002 at 04:33 UTC
    Thank you for that. I realized after seeing your code that I can do that for my code. I've got two entry lines and I will have the user click the button so I can get them then.

    As I put in my amendment however, is there a way to do this without using the button(-command=>) approach?

    Thanks again!