Human UI close window on button click within window


I am wondering whether it is possible to have a “close” button inside a Human UI window to close that same window (i.e. change the “show window” toggle to false)? My intention is that I have a button in another Human UI window that the user can click to open the secondary window, and then hit “close” within the secondary window to hide it again.

I have tried the following definition, and the “Close” button works to close the window, but the problem is that when the window closes the button gets stuck on “True” and does not send the unclick “False” (presumably because the window closes before the unclick).

I’ve tried adding a data dam or a python sleep component to delay the closing of the window until the unclick event has happened, but those methods don’t work. Data dam only sends through the data that exists at the end of the dam interval, so by the time the delay is over the button is unclicked and it only sends through the false. The python sleep method stops all computation so the same problem exists as without it (the button stays pressed during the pause and window closes immediately after the True is sent at the end of the pause). I’m quite a newby with python so forgive me if those things are obvious.

Appreciate any suggestions - thanks! (10.6 KB)

a bastard solution with data input and data output…

Thank you. I got that to work with the button connected only through the 1 stream on the stream filter. However, it slows down my script significantly (especially with multiple data out/in loops in the file).

If there is a more direct solution that would be great.

Anything new on that subject ?