Specification
- pywebview version: 4.0.2
- operating system: windows 10
- web renderer: Edge chromium/any
Description
Firstly - Hi! And thanks for developing such a great tool!
My problem is occuring when I try to hide webview window on event closing.
Here is the code:
import webview
def on_closing():
window.hide() # Here is the problem (maybe doing it other way would work, but _tbh idk_ how.)
return False # Tried with False and True, but none worked
window = webview.create_window(title="Hide test", url="https://github.com/r0x0r/pywebview/issues/new")
window.events.closing += on_closing
webview.start(gui='edgehtml')
When running this code no error is produced. But when I try to close the app it freezes the whole python process.
I think the problem lies somewhere in my logic. Maybe the on_closing event is called even on the window.hide resulting in infinite loop. But to be honest, I do not know what other approach I could use to achieve this.
Use case: I am developing time tracking app and I want to keep the tracker running even "after close". So I feel like the simplest solution is to just hide the window instead of closing. There are another ways of doing so, like spawning another process that tracks the time and handles the opening of the webview gui or substracting the "last_opened" time from "current_time" when gui would be opened. Even creating custom menubar and handling the hide from js side is also an option. But as I said I think that the hide method is the simplest for me, so I choosed it.
TL;DR: How can I keep the window running hidden instead of closing?
Specification
Description
Firstly - Hi! And thanks for developing such a great tool!
My problem is occuring when I try to hide webview window on event closing.
Here is the code:
When running this code no error is produced. But when I try to close the app it freezes the whole python process.
I think the problem lies somewhere in my logic. Maybe the
on_closingevent is called even on thewindow.hideresulting in infinite loop. But to be honest, I do not know what other approach I could use to achieve this.Use case: I am developing time tracking app and I want to keep the tracker running even "after close". So I feel like the simplest solution is to just hide the window instead of closing. There are another ways of doing so, like spawning another process that tracks the time and handles the opening of the webview gui or substracting the "last_opened" time from "current_time" when gui would be opened. Even creating custom menubar and handling the hide from js side is also an option. But as I said I think that the hide method is the simplest for me, so I choosed it.
TL;DR: How can I keep the window running hidden instead of closing?