diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:

I have implemented the ability to hit the enter key in the past to submit with Tk but now it is not working here is the code i have need to implement the ability to hit enter.

# Widget Button1 isa Button
$ZWIDGETS{'Button1'} = $MW->Button(
-text => 'Submit',
-command => $MW => 'destroy',
)->grid(
-row => 1,
-column => 3,
);

Replies are listed 'Best First'.
Re: Tk and <return>
by zentara (Cardinal) on Jul 02, 2012 at 08:40 UTC
    Just from guessing at what you mean by i have need to implement the ability to hit enter. you can do the same thing the button does with an Enter by this:
    # be sure to use Return and not Enter, Enter is for the mouse events $mw->bind( '<Return>', sub { $mw->destroy } );

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Tk and <return>
by Anonymous Monk on Jul 02, 2012 at 00:15 UTC

    but now it is not working here is the code i

    That doesn't compile ;)

    How do I post a question effectively?

     perl -MTk -e " $mw = tkinit; $mw->Button( -command => [ $mw, q/destroy/ ] )->pack; MainLoop; "