morgon has asked for the wisdom of the Perl Monks concerning the following question:
is it possible to print from a curses-program in such a way that the output is retained after the script ends?
To illustrate:
So my thinking was that calling endwin in the handler would end all the curses-magic and you could print stuff that curses would no longer overwrite, but unfortunately that does not work.use Curses::UI; my $cui = new Curses::UI; my $win = $cui->add('window_id', 'Window'); my $listbox = $win->add( 'mylistbox', 'Listbox', -values => [1, 2, 3], -labels => { 1 => 'One', 2 => 'Two', 3 => 'Three' }, ); $listbox->onChange( sub { my $sel = $listbox->get; endwin; print $sel; exit; } ); $cui->set_binding( sub { exit(0); } , "\cC"); $cui->mainloop;
Does anyone know how to do this (I am a complete newbie with curses I am afraid).
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print from curses
by Anonymous Monk on Feb 01, 2017 at 02:44 UTC | |
by morgon (Priest) on Feb 01, 2017 at 09:12 UTC |