-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathieWin_test.py
executable file
·42 lines (31 loc) · 1.14 KB
/
ieWin_test.py
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
#!/usr/bin/env python
import wx
if wx.Platform == '__WXMSW__':
import wx.lib.iewin as iewin
else:
raise ImportError("This test only works on windows")
class DemoFrame(wx.Frame):
""" This window displays a button """
def __init__(self, title="Micro App"):
wx.Frame.__init__(self, None , -1, title)
btn = wx.Button(self, label="Get HTML")
btn.Bind(wx.EVT_BUTTON, self.GetHTML)
self.Bind(wx.EVT_CLOSE, self.GetHTML)
self.htwin = iewin.IEHtmlWindow(self)
self.htwin.Navigate('http://cameochemicals.noaa.gov/')
S = wx.BoxSizer(wx.VERTICAL)
S.Add(btn, 0, wx.ALL, 5)
S.Add(self.htwin, 1, wx.EXPAND)
self.SetSizer(S)
self.SetSize((700, 500))
self.Bind(wx.EVT_CLOSE, self.OnQuit)
def OnQuit(self,Event):
self.Destroy()
def GetHTML(self, event=None):
print("contents of HTML window as text: ", self.htwin.GetText(asHTML=False)[:500])
print("contents of HTML window as html: ", self.htwin.GetText(asHTML=True))
if __name__ == "__main__" :
app = wx.App(False)
frame = DemoFrame()
frame.Show()
app.MainLoop()