[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Catching Figure close button - callbacks not running?
From: |
Richardson, Anthony |
Subject: |
RE: Catching Figure close button - callbacks not running? |
Date: |
Tue, 29 Jan 2019 19:17:59 +0000 |
> -----Original Message-----
> From: Help-octave <help-octave-
> address@hidden> On Behalf Of Przemek
> Klosowski
> Sent: Tuesday, January 29, 2019 1:12 PM
> To: address@hidden
> Subject: Re: Catching Figure close button - callbacks not running?
>
> On 1/29/19 1:19 PM, Richardson, Anthony wrote:
> > set(gct, 'DeleteFcn' @(h, e) disp('bye bye'))
>
> It works, but the printout seems to be buffered somehow and only appears
> after the next command is entered at the CLI.
>
> Specifically, I use commandline Octave 4.2.2 on Fedora Linux, and type
>
> gcf=figure(1)
> set(gcf, 'DeleteFcn', @(h, e) disp('bye bye'))
>
> nothing happens when I close the window, and I need to hit Enter on the
> Octave prompt to see the "bye bye" string.
>
> I thought that it's buffered because it doesn't have a newline, but
>
> set(gcf, 'DeleteFcn', @(h, e) printf('bye bye\n'))
>
> behaves in the same way. It looks like it needs an explicit fflush():
>
> set(gcf, 'DeleteFcn', @(h, e) {printf('bye bye\n'); fflush(stdout)})
>
> 'more off' works too.
>
> It surprised me because we're not in octave REPL loop after the callback runs,
> but I guess the callbacks are buffering because the interpreter does not
> know in advance when they would be done running.
>
>
Ahhh. I am using Windows. Output in this example appears to be immediately
flushed in Windows.
I don't know if this is true for all output to stdout or is specific to disp()
or something else.
Tony Richardson
- Catching Figure close button, Pavel Hofman, 2019/01/28
- Re: Catching Figure close button - callbacks not running?, Pavel Hofman, 2019/01/29
- RE: Catching Figure close button - callbacks not running?, Richardson, Anthony, 2019/01/29
- Re: Catching Figure close button - callbacks not running?, pavel, 2019/01/29
- RE: Catching Figure close button - callbacks not running?, Richardson, Anthony, 2019/01/29
- Re: Catching Figure close button - callbacks not running?, pavel, 2019/01/29
- RE: Catching Figure close button - callbacks not running?, Richardson, Anthony, 2019/01/29
- RE: Catching Figure close button - callbacks not running?, Pantxo, 2019/01/30
- Re: Catching Figure close button - callbacks not running?, Pavel Hofman, 2019/01/30
- Re: Catching Figure close button - callbacks not running?, Pantxo Diribarne, 2019/01/30
- Re: Catching Figure close button - callbacks not running?, Pavel Hofman, 2019/01/30
- Re: Catching Figure close button - callbacks not running?, Pantxo Diribarne, 2019/01/30
- Re: Catching Figure close button - callbacks not running?, Pavel Hofman, 2019/01/31