View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Mark Daglish > Tk-TextDialog > Tk::TextDialog


Annotate this POD

View/Report Bugs


Tk::TextDialog - Dialog widget with text entry.


  use Tk;
  use Tk::TextDialog;

  $d = $w -> TextDialog ( -font => [-family=>'helvetica',-size=>12, -weight=>'normal'],
                           -title => 'Text Entry',
                           -textlabel => 'Please enter your text:');
  $d -> WaitForInput;
  $d -> destroy;


  The -font option defaults to helvetica 12

  The -textlabel option prints the text of its argument in label above
  the text entry box.

  After WaitForInput is called, clicking on the 'Accept' button closes the dialog
  and returns the text in the entry box.

  The WaitForInput method does not destroy the dialog window.  Instead 
  WaitForInput unmaps the dialog box from the display.  To de-allocate 
  the widget, you must explicitly call $w -> destroy or $w -> DESTROY.

  Refer to the Tk::options man page for a description of options 
  common to all Perl/Tk widgets.


    use Tk;
    use Tk::TextDialog;

    my $w = new MainWindow;

    my $b = $w -> Button (-text => 'Dialog',
                          -command => sub{&show_dialog($w)}) -> pack;

    sub show_dialog {
        my ($w) = @_;
        my $e;
        if (not defined $e) {
            $e = $w -> TextDialog (-title => 'Enter Text', -height=>5, -width=>20); # Height and width of the text box
        $e -> configure (-textlabel => 'Please enter your text:');
        my $resp = $e -> WaitForInput;
        print "$resp\n";
        $e -> configure (-textlabel => '');
        my $resp = $e -> WaitForInput;
        print "$resp\n";
        return $resp;



  $Revision: 0.0.1 $

  Licensed for free distribution under the terms of the 
  Perl Artistic License.

  Written by Mark Daglish ,>, but heavily copied from the EntryDialog module written 
  by Robert Allan Kiesling <> and Dave Scheck <>.
syntax highlighting: