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
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
__revision__ = '0.1'
__author__ = 'lxd'
import wx
import wx.webview
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'name', size=(800, 600))
self.url = wx.TextCtrl(self, -1)
self.html = wx.webview.WebView(self, -1)
self.btnLoad = wx.Button(self, -1, u'进入')
self.Bind(wx.EVT_BUTTON, self.OnLoadClick, self.btnLoad)
self.layout()
def layout(self):
self.Center()
setupBox = wx.StaticBox(self, -1, u'基本设置')
setupSizer = wx.StaticBoxSizer(setupBox, wx.VERTICAL)
setupSizer.Add(self.url, 0, wx.EXPAND|wx.ALL, 5)
setupSizer.Add(self.btnLoad, 0, wx.ALL, 5)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(setupSizer, 0, wx.EXPAND|wx.ALL, 5)
mainSizer.Add(self.html, 1, wx.EXPAND|wx.ALL, 5)
self.SetSizer(mainSizer)
def OnLoadClick(self, evt):
self.html.LoadURL(self.url.GetValue())
if __name__ == '__main__':
app = wx.PySimpleApp()
main = MainFrame()
main.Show()
app.MainLoop()
|