Skip to content

Instantly share code, notes, and snippets.

@benfairless
Last active May 15, 2021 15:45
Show Gist options
  • Save benfairless/3822f77eb07e8e8efb2e to your computer and use it in GitHub Desktop.
Save benfairless/3822f77eb07e8e8efb2e to your computer and use it in GitHub Desktop.
Python GTK kiosk web browser
#!/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()
@benfairless
Copy link
Author

Example usage:
$ kiosk.py http://google.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment