Created
June 25, 2015 06:22
-
-
Save moleike/0e11793fa0999314ea42 to your computer and use it in GitHub Desktop.
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 | |
# -*- coding: utf-8 -*- | |
import gtk | |
import webkit | |
def entry_activated_cb(entry, embed): | |
embed.load_uri(entry.get_text()) | |
# Widgets and signals | |
window = gtk.Window() | |
window.set_default_size(800, 600) | |
window.set_title("Mini browser written in Python") | |
embed = webkit.WebView(); # WebKit embed | |
entry = gtk.Entry() | |
entry.connect('activate', entry_activated_cb, embed) | |
scroller = gtk.ScrolledWindow() | |
scroller.add(embed) | |
# Pack everything up and show | |
vbox = gtk.VBox(False, 5) | |
vbox.pack_start(entry, False, False) | |
vbox.pack_start(scroller) | |
window.add(vbox) | |
window.show_all() | |
# Load a default URI and run | |
embed.load_uri("http://www.webkit.org") | |
gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment