Alrighty, try this:

#!/usr/bin/env perl use strict; use warnings; use Curses::UI; my $cui = new Curses::UI( -color_support => 1, ); my $window = $cui->add( "main_window", "Window", -width => 70, -height => 4, ); my $text_editor = $window->add( "description_text", "TextEditor", -text => "", -title => "Enter Description", -border => 1, -singleline => 1, -width => 40, -bfg => "red", -titlereverse => 0, -showlines => 1, -x => 0, -y => 0, ); my $okay_button = $window->add( "buttons", "Buttonbox", -border => 1, -width => 6, -bfg => "blue", -x => 40, -y => 0, -buttons => [ { -label => "Okay", -value => 1, -shortcut => "o", -onpress => sub { $cui->le +ave_curses(); print "O +utside of mainloop!\n"; sleep(2) +; $cui->re +set_curses(); }, }, ], ); my $exit_button = $window->add( "exit", "Buttonbox", -border => 1, -width => 6, -bfg => "blue", -x => 46, -y => 0, -buttons => [ { -label => "Exit", -value => 1, -shortcut => "x", -onpress => sub { $cui-> +mainloopExit; }, }, ], ); $text_editor->focus; $cui->mainloop;

Now, using the Okay button flashes you to the terminal for a couple seconds to see the output of print and then goes back to Curses.

Hope this helps


In reply to Re: mixing curses::ui with stdout program by bms
in thread mixing curses::ui with stdout program by mzagrabe

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.