- Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathWebKit.py
More file actions
Latest commit
executable file
·93 lines (67 loc) · 2.91 KB
/
Copy pathWebKit.py
File metadata and controls
executable file
·93 lines (67 loc) · 2.91 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python
importwx
fromwximportwebview
classDemoFrame(wx.Frame):
""" This window displays a WebKit window """
def__init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.WKWindow=webview.WebView(self)
self.WKWindow.LoadURL("http://www.google.com")
#self.WKWindow = webkit.WebKitCtrl(self)
#self.WKWindow = wx.Panel(self)
#self.WKWindow.SetBackgroundColour("red")
self.Bind(webview.EVT_WEBVIEW_NEW_WINDOW, self.OnNewWindow)
#self.Fit()
MenuBar=wx.MenuBar()
FileMenu=wx.Menu()
item=FileMenu.Append(wx.ID_ANY, text="&Open")
self.Bind(wx.EVT_MENU, self.OnOpen, item)
item=FileMenu.Append(wx.ID_PREFERENCES, text="&Preferences")
self.Bind(wx.EVT_MENU, self.OnPrefs, item)
item=FileMenu.Append(wx.ID_EXIT, text="&Exit")
self.Bind(wx.EVT_MENU, self.OnQuit, item)
MenuBar.Append(FileMenu, "&File")
HelpMenu=wx.Menu()
item=HelpMenu.Append(wx.ID_HELP, "Test &Help",
"Help for this simple test")
self.Bind(wx.EVT_MENU, self.OnHelp, item)
## this gets put in the App menu on OS-X
item=HelpMenu.Append(wx.ID_ABOUT, "&About",
"More information About this program")
self.Bind(wx.EVT_MENU, self.OnAbout, item)
MenuBar.Append(HelpMenu, "&Help")
self.SetMenuBar(MenuBar)
self.Bind(wx.EVT_CLOSE, self.OnQuit)
defOnNewWindow(self, evt):
print"NewWindow"
defOnQuit(self,Event):
self.Destroy()
defOnAbout(self, event):
dlg=wx.MessageDialog(self, "This is a small program to test\n"
"the use of menus on Mac, etc.\n",
"About Me", wx.OK|wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
defOnHelp(self, event):
dlg=wx.MessageDialog(self, "This would be help\n"
"If there was any\n",
"Test Help", wx.OK|wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
defOnOpen(self, event):
dlg=wx.MessageDialog(self, "This would be an open Dialog\n"
"If there was anything to open\n",
"Open File", wx.OK|wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
defOnPrefs(self, event):
dlg=wx.MessageDialog(self, "This would be an preferences Dialog\n"
"If there were any preferences to set.\n",
"Preferences", wx.OK|wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
if__name__=="__main__":
app=wx.App(False)
frame=DemoFrame(None, title="WebKit test", size=(500, 500))
frame.Show()
app.MainLoop()