Skip to content

Commit 1523119

Browse files
committed
Update wxpython.py example for wxPython 4.0 (cztomczak#348).
Thanks to Andrew Leech for the patch.
1 parent e96ae89 commit 1523119

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/Tutorial.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ a replacement for standard GUI toolkits such as wxWidgets,
77
Qt or GTK. With this tutorial you will learn CEF Python
88
basics. This tutorial will discuss the two basic examples:
99
[hello_world.py](../examples/hello_world.py)
10-
and [tutorial.py](../examples/tutorial.py). There are more
11-
many more examples that you can find in the [Examples-README.md](../examples/Examples-README.md)
10+
and [tutorial.py](../examples/tutorial.py). There are many
11+
more examples that you can find in the [Examples-README.md](../examples/Examples-README.md)
1212
file, but these examples are out of scope for this tutorial.
1313

1414

@@ -33,8 +33,7 @@ You can install with pip. On Linux pip 8.1+ is required. Alternatively
3333
you can download packages for offline installation from [GitHub Releases](../../../releases).
3434

3535
Run the commands below to install the cefpython3 package, clone
36-
the github repository, enter the examples/ directory and run the
37-
Hello World example:
36+
the repository and run the Hello World example:
3837

3938
```commandline
4039
pip install cefpython3==56.1

examples/wxpython.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def create_menu(self):
109109

110110
def embed_browser(self):
111111
window_info = cef.WindowInfo()
112-
(width, height) = self.browser_panel.GetClientSizeTuple()
112+
(width, height) = self.browser_panel.GetClientSize().Get()
113113
window_info.SetAsChild(self.browser_panel.GetHandle(),
114114
[0, 0, width, height])
115115
self.browser = cef.CreateBrowserSync(window_info,
@@ -197,14 +197,15 @@ def create_timer(self):
197197
# http://wiki.wxwidgets.org/Making_a_render_loop
198198
# Another way would be to use EVT_IDLE in MainFrame.
199199
self.timer = wx.Timer(self, self.timer_id)
200+
self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
200201
self.timer.Start(10) # 10ms timer
201-
wx.EVT_TIMER(self, self.timer_id, self.on_timer)
202202

203203
def on_timer(self, _):
204204
cef.MessageLoopWork()
205205

206206
def OnExit(self):
207207
self.timer.Stop()
208+
return 0
208209

209210

210211
if __name__ == '__main__':

0 commit comments

Comments
 (0)