forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample1.py
More file actions
34 lines (27 loc) · 1.01 KB
/
sample1.py
File metadata and controls
34 lines (27 loc) · 1.01 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
# Simple sample ilustrating the usage of CEFWindow class
# __author__ = "Greg Kacy <grkacy@gmail.com>"
import os
import wx
import cefpython1.wx.chromectrl as chrome
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
title='cefwx example1', size=(600,400))
self.cefWindow = chrome.ChromeWindow(self,
url=os.path.join(os.path.dirname(os.path.abspath(__file__)),
"sample1.html"))
sizer = wx.BoxSizer()
sizer.Add(self.cefWindow, 1, wx.EXPAND, 0)
self.SetSizer(sizer)
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, event):
self.Destroy()
if __name__ == '__main__':
chrome.Initialize()
print('sample1.py: wx.version=%s' % wx.version())
app = wx.PySimpleApp()
MainFrame().Show()
app.MainLoop()
# Important: do the wx cleanup before calling Shutdown.
del app
chrome.Shutdown()