Last active
July 22, 2023 20:05
-
-
Save WingTillDie/d5a52f7f3969f0388e3a88cb9af66ff7 to your computer and use it in GitHub Desktop.
Pywebview with set title from document.title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import webview | |
def set_title(): | |
window = webview.windows[0] | |
result = window.evaluate_js('document.title') | |
window.set_title(result) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser( | |
prog='webview-document-title.py', | |
description='Pywebview with set title from document.title', | |
) | |
parser.add_argument('URL', nargs='?', default = "https://www.google.com") | |
args = parser.parse_args() | |
window = webview.create_window(None, args.URL) | |
window.events.loaded += set_title | |
window.events.moved += set_title | |
webview.start(set_title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment