G'day ankit.tayal560,

"How to create a dialog box with perl/Tk ..."

See the Tk Distribution Page for a variety of core widgets for dialogue boxes, message popups, colour pickers, file selectors, and so on. I have this page bookmarked and refer to it often; I suggest you do the same.

I further recommend that you generally familiarise yourself with the widgets that are available. This will help you search this page for the wanted functionality. For instance, searching for widgets matching:

dialog
10 matches. As a general rule, use these for multiple responses: OK/Cancel; OK/Retry/Abort; and so on.
message
3 matches. Use these for single response acknowledgements: "Info: Process Complete." → [OK]; "Error: Bug in code." → [Bugger!]; and so on.
file
color
Multiple matches. Usage: self-explanatory.

You can also find usage examples in the widget demo (widget & from the command line on *nix). Be aware that most of this code is very old and some of it is now discouraged in favour of newer methods. There's probably more, but two immediately came to mind.

From the vars pragma DESCRIPTION:
"NOTE: For use with variables in the current package for a single scope, the functionality provided by this pragma has been superseded by our declarations, available in Perl v5.6.0 or later, and use of this pragma is discouraged. See our."
From perlobj: Indirect Object Syntax:
"Outside of the file handle case, use of this syntax is discouraged as it can confuse the Perl interpreter. See below for more details." [original text emboldened]

— Ken


In reply to Re: How to create a dialog box with perl/Tk that does not end your script? by kcott
in thread How to create a dialog box with perl/Tk that does not end your script? by ankit.tayal560

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.