Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import gtk, webkit
- def go_but(widget):
- add = addressbar.get_text()
- if add.startswith("http://"):
- web.open(add)
- else:
- add = "http://" + add
- addressbar.set_text(add)
- web.open(add)
- def zoom_in(widget):
- web.zoom_in()
- def zoom_out(widget):
- web.zoom_out()
- win = gtk.Window()
- win.connect('destroy', lambda w: gtk.main_quit())
- box1 = gtk.VBox()
- win.add(box1)
- box2 = gtk.HBox()
- box1.pack_start(box2, False)
- addressbar = gtk.Entry()
- box2.pack_start(addressbar)
- gobutton = gtk.Button("GO")
- box2.pack_start(gobutton)
- gobutton.connect('clicked', go_but)
- zoom_in_button = gtk.Button("+")
- box2.pack_start(zoom_in_button)
- zoom_in_button.connect('clicked', zoom_in)
- zoom_out_button = gtk.Button("-")
- box2.pack_start(zoom_out_button)
- zoom_out_button.connect('clicked', zoom_out)
- scroller = gtk.ScrolledWindow()
- box1.pack_start(scroller)
- web = webkit.WebView()
- scroller.add(web)
- win.show_all()
- gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement