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

Hi Perl Monks, need your suggestions. In my application i need to implement the command prompt in a Entry widget. I request you to please provide me your valuable suggestions for implementing the same.
  • Comment on need suggestions in implementing command prompt

Replies are listed 'Best First'.
Re: need suggestions in implementing command prompt
by zentara (Cardinal) on Jul 03, 2008 at 20:11 UTC
    Try Tk::ExecuteCommand. Type whatever command you want into the entry widget. (May not work well on Windows).
    #!/usr/bin/perl -w use Tk; use Tk::ExecuteCommand; use Tk::widgets qw/LabEntry/; use strict; my $mw = MainWindow->new; my $ec = $mw->ExecuteCommand( -command => '', -entryWidth => 50, -height => 10, -label => '', -text => 'Execute', )->pack; $ec->configure(-command => 'date; sleep 10; date'); my $button = $mw->Button(-text =>'Do_it', -background =>'hotpink', -command => sub{ $ec->execute_command }, )->pack; MainLoop;

    I'm not really a human, but I play one on earth CandyGram for Mongo
Re: need suggestions in implementing command prompt
by pc88mxer (Vicar) on Jul 03, 2008 at 18:44 UTC
Re: need suggestions in implementing command prompt
by moritz (Cardinal) on Jul 03, 2008 at 18:03 UTC
    Normally you'd put the prompt into a text label on the left hand side of the Entry widget, and that's how I'd do it.

    A prompt is usually not modifiable, but the the contents of an Entry widget is either modifiable as a whole or not at all, so I guess you can't emulate a prompt in such a widget.

    A reply falls below the community's threshold of quality. You may see it by logging in.