Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: mixing curses::ui with stdout program

by bms (Monk)
on Mar 28, 2012 at 20:14 UTC ( #962249=note: print w/ replies, xml ) Need Help??


in reply to mixing curses::ui with stdout program

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


Comment on Re: mixing curses::ui with stdout program
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://962249]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2015-07-02 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls