in reply to How to create a dialog box with perl/Tk that does not end your script?

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

  • Comment on Re: How to create a dialog box with perl/Tk that does not end your script?
  • Download Code