Search code examples
perluser-interfaceperltk

Multi Line input using Perl/Tk


I was trying GUI in Perl using Perl/Tk. I couldn't find a way to take multi line text input from the user using any widget. For single line "Entry" can be used but I could find nothing for multi line input. Is there any way?


Solution

  • Mulit-line input is done with the text widget, as in:

    # Text widget 20 characters wide and 10 lines tall
    $mw->Text(-width => 20, -height => 10)->pack;
    

    If you're new to Perk/Tk, I strongly suggest running widget from the command line. It's an interactive demo (with code explanations) of Tk widgets and their options.