File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 22# This example has a top menu and a browser widget without navigation bar.
33
44# Tested configurations:
5- # - wxPython 4.0 on Windows/Linux
5+ # - wxPython 4.0 on Windows/Mac/ Linux
66# - wxPython 3.0 on Windows/Mac
77# - wxPython 2.8 on Linux
88# - CEF Python v55.4+
@@ -189,14 +189,31 @@ class CefApp(wx.App):
189189 def __init__ (self , redirect ):
190190 self .timer = None
191191 self .timer_id = 1
192+ self .is_initialized = False
192193 super (CefApp , self ).__init__ (redirect = redirect )
193194
195+ def OnPreInit (self ):
196+ super (CefApp , self ).OnPreInit ()
197+ # On Mac with wxPython 4.0 the OnInit() event never gets
198+ # called. Doing wx window creation in OnPreInit() seems to
199+ # resolve the problem (Issue #350).
200+ if MAC and wx .version ().startswith ("4." ):
201+ print ("[wxpython.py] OnPreInit: initialize here"
202+ " (wxPython 4.0 fix)" )
203+ self .initialize ()
204+
194205 def OnInit (self ):
206+ self .initialize ()
207+ return True
208+
209+ def initialize (self ):
210+ if self .is_initialized :
211+ return
212+ self .is_initialized = True
195213 self .create_timer ()
196214 frame = MainFrame ()
197215 self .SetTopWindow (frame )
198216 frame .Show ()
199- return True
200217
201218 def create_timer (self ):
202219 # See also "Making a render loop":
Original file line number Diff line number Diff line change @@ -242,6 +242,8 @@ def get_python_include_path():
242242 try_dirs = ["{base_dir}/include" ,
243243 "{base_dir}/../include/python{ver}" ,
244244 "{base_dir}/../include/python{ver}*" ,
245+ ("{base_dir}/../Frameworks/Python.framework/Versions/{ver}"
246+ "/include/python{ver}*" ),
245247 "/usr/include/python{ver}" ]
246248 ver_tuple = sys .version_info [:2 ]
247249 ver = "{major}.{minor}" .format (major = ver_tuple [0 ], minor = ver_tuple [1 ])
You can’t perform that action at this time.
0 commit comments