esc key to quit, fullscreen and frameless window.
This commit is contained in:
parent
16f9f0ca71
commit
41c84a4610
2 changed files with 16 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ Infinitely scroll Bluesky posts on a 320x240 pixel TFT
|
||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import webview
|
import webview
|
||||||
|
|
@ -180,10 +181,16 @@ class Api:
|
||||||
# pylint: disable=unnecessary-pass
|
# pylint: disable=unnecessary-pass
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def quit(self):
|
||||||
|
window.destroy()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
# create a webview and load the index.html page
|
# create a webview and load the index.html page
|
||||||
webview.create_window(
|
window = webview.create_window(
|
||||||
"bsky posts", "static/index.html", js_api=Api(), width=320, height=240
|
"bsky posts", "static/index.html", js_api=Api(), width=320, height=240,
|
||||||
|
x=0, y=0, frameless=True, fullscreen=True
|
||||||
|
|
||||||
)
|
)
|
||||||
webview.start()
|
webview.start()
|
||||||
# webview.start(debug=True) # use this one to enable chromium dev tools to see console.log() output from the page.
|
# webview.start(debug=True) # use this one to enable chromium dev tools to see console.log() output from the page.
|
||||||
|
|
|
||||||
|
|
@ -117,3 +117,10 @@ function autoScroll() {
|
||||||
pywebview.api.check_quit();
|
pywebview.api.check_quit();
|
||||||
window.scrollBy(0, 2);
|
window.scrollBy(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('keydown', function(event){
|
||||||
|
/* Quit if the user presses esc key */
|
||||||
|
if (event.key === "Escape"){
|
||||||
|
pywebview.api.quit();
|
||||||
|
}
|
||||||
|
} );
|
||||||
Loading…
Reference in a new issue