initial commit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import webview
|
||||
from webview import Window
|
||||
|
||||
|
||||
def webview_file_dialog():
|
||||
def open_file_dialog(w: Window):
|
||||
try:
|
||||
return w.create_file_dialog(webview.FOLDER_DIALOG)[0]
|
||||
except TypeError:
|
||||
pass # user exited file dialog without picking
|
||||
finally:
|
||||
w.hide()
|
||||
w.destroy()
|
||||
|
||||
window = webview.create_window("", hidden=True)
|
||||
webview.start(open_file_dialog, window)
|
||||
# file will either be a string or None
|
||||
return file
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(webview_file_dialog())
|
||||
Reference in New Issue
Block a user