Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.is_shown always returns True #21

Open
ludwigkraatz opened this issue Jun 30, 2024 · 1 comment
Open

window.is_shown always returns True #21

ludwigkraatz opened this issue Jun 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ludwigkraatz
Copy link

ludwigkraatz commented Jun 30, 2024

I like the project a lot, so far.

But for some reason, the 'is_shown' method on a window does not do, what i would expect it to do.

To demonstrate the issue:

from webui import webui
import time

window = webui.window()

window.show('<html><head><script src="webui.js"></script></head><body>close me</body></html>')
while window.is_shown():
    print('is shown')
    time.sleep(1)

now, when i close the window that opens - i would expect the console to stop printing 'is shown'.
but it happily continues.

instead, i found

from webui import webui

window = webui.window()
if window.is_shown():
    print('is shown')

also prints 'is shown'.
which.. kindof seems, that this whole method doesn't do anything useful?

okay, after further looking into it:

from webui import webui

window = webui.window()
window.close()
if window.is_shown():
    print('is shown - even when closed')
window.destroy()
if window.is_shown():
    print('is not shown anymore!')

so the 'is_shown()' method only reacts to a '.destroy()' on the window. Which.. sounds like a 'is_not_destroyed()' tbh (:

'webui.wait()' - to further illustrate my problem:

from webui import webui

_ = webui.window()
window = webui.window()

webui.wait()
print('BOTH(!) windows are closed now.')

if window.is_shown():
    print('and even now the window "is_shown"')

so:
is there a way to catch an event of ONE SPECIFIC window being closed?
I can close it programatically from within python and manage things on that side, sure - no issues there.
But I also need to know when the window itself is being closed, without any code being the reason.

I'd appreciate useful hints!

tested with:
Python 3.7
WebUI v2.4.5
MacOS 10.15.7

@hassandraga hassandraga added the bug Something isn't working label Jun 30, 2024
@hassandraga
Copy link
Member

This is probably a bug in the Python wrapper.
We will update this wrapper as soon as core v2.5 gets released.
Thank you @ludwigkraatz for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants