/
cookbook
55 lines (38 loc) · 1.03 KB
/
cookbook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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 new_title(view, frame, title):
win.set_title(title)
def on_click_link(view, frame):
uri=frame.get_uri()
#addressbar.set_text(uri)
win = gtk.Window()
win.set_default_size(890,700)
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()
#addressbar.connect("activate", go_but)
#box2.pack_start(addressbar)
#gobutton = gtk.Button("GO")
#box2.pack_start(gobutton, False)
#gobutton.connect('clicked', go_but)
scroller = gtk.ScrolledWindow()
box1.pack_start(scroller)
web = webkit.WebView()
web.open("file:///usr/share/cookbook/index.html")
#web.open("http://website.org")
web.connect("title-changed", new_title)
web.connect("load-committed", on_click_link)
scroller.add(web)
win.show_all()
gtk.main()