#!/usr/bin/perl ############################# # Name: Clock-Tk.pl # Desc: Display Tk clock. ############################# use strict; use warnings; use Tk; my ($n,$mw); my $mw_width = 420; my $mw_height = 40; my $mw_left = 2570; my $mw_top = 20; $mw = MainWindow->new(); $mw->geometry("${mw_width}x${mw_height}+${mw_left}+${mw_top}"); $mw->bind('<Escape>' => sub {exit;}); $mw->optionAdd('*font','Courier 20 bold'); $mw->Label(-textvariable=>\$n,-background=>'lavender')->pack; $mw->repeat(100,sub{$n=scalar localtime time}); MainLoop();

I am running Strawberry Perl 5.24.1 on Windows 10. I copied the Tk clock one-liner that Discipulus put in Cool Uses for Perl and made it into a script, adding a "geometry" statement to place it where I want on the screen. The script runs fine. I converted the script to an executable using perl2exe Pro. The executable also runs fine.

The problem occurs when I start the executable in a cmd window with the "/b" option to free my cmd window to issue other commands. After entering "start /b Clock-Tk.exe" and pressing ENTER, I must press ENTER a second time before the program starts.

I have numerous other TK scripts that I have converted to executables using perl2exe Pro, and none of those require a second ENTER to start.

I cannot see what is unique to this program that is causing the problem. Does anyone have an idea what is causing this script to require a second ENTER in order to start?

Thanks.

"It's not how hard you work, it's how much you get done."


In reply to Tk Program Converted to Executable Requires 2 ENTERs to Run by roho

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.