Last active
May 15, 2021 15:45
-
-
Save benfairless/3822f77eb07e8e8efb2e to your computer and use it in GitHub Desktop.
Python GTK kiosk web browser
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 python | |
import pygtk | |
import gtk | |
import webkit | |
import sys | |
class Browser: | |
def __init__(self): | |
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) | |
self.window.fullscreen() | |
#self.window.set_default_size(600,400) | |
#self.window.set_resizable(True) | |
self.web_view = webkit.WebView() | |
self.web_view.open(str(sys.argv[1])) | |
scroll_window = gtk.ScrolledWindow(None, None) | |
scroll_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) | |
scroll_window.set_placement(gtk.CORNER_TOP_LEFT) | |
scroll_window.add(self.web_view) | |
box = gtk.VBox(False, 0) | |
box.add(scroll_window) | |
self.window.add(box) | |
self.window.show_all() | |
def main(self): | |
gtk.main() | |
if __name__ == "__main__": | |
browser = Browser() | |
browser.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage:
$ kiosk.py http://google.com/