11# Tutorial example. Doesn't depend on any third party GUI framework.
2- # Tested with CEF Python v56.1 +
2+ # Tested with CEF Python v56.2 +
33
44from cefpython3 import cefpython as cef
55import base64
@@ -61,7 +61,7 @@ def main():
6161 cef .Initialize ()
6262 set_global_handler ()
6363 browser = cef .CreateBrowserSync (url = html_to_data_uri (HTML_code ),
64- window_title = "Hello World! " )
64+ window_title = "Tutorial " )
6565 set_client_handlers (browser )
6666 set_javascript_bindings (browser )
6767 cef .MessageLoop ()
@@ -72,7 +72,7 @@ def check_versions():
7272 print ("[tutorial.py] CEF Python {ver}" .format (ver = cef .__version__ ))
7373 print ("[tutorial.py] Python {ver} {arch}" .format (
7474 ver = platform .python_version (), arch = platform .architecture ()[0 ]))
75- assert cef .__version__ >= "56.1 " , "CEF Python v56.1 + required to run this"
75+ assert cef .__version__ >= "56.2 " , "CEF Python v56.2 + required to run this"
7676
7777
7878def html_to_data_uri (html , js_callback = None ):
@@ -125,10 +125,6 @@ def js_print(browser, lang, event, msg):
125125
126126class GlobalHandler (object ):
127127 def OnAfterCreated (self , browser , ** _ ):
128- # Issue #344 will fix this in next release, so that client
129- # handlers are not called for Developer Tools windows.
130- if browser .GetUrl ().startswith ("chrome-devtools://" ):
131- return
132128 # DOM is not yet loaded. Using js_print at this moment will
133129 # throw an error: "Uncaught ReferenceError: js_print is not defined".
134130 # We make this error on purpose. This error will be intercepted
@@ -143,10 +139,6 @@ def OnAfterCreated(self, browser, **_):
143139
144140class LoadHandler (object ):
145141 def OnLoadingStateChange (self , browser , is_loading , ** _ ):
146- # Issue #344 will fix this in next release, so that client
147- # handlers are not called for Developer Tools windows.
148- if browser .GetUrl ().startswith ("chrome-devtools://" ):
149- return
150142 # This callback is called twice, once when loading starts
151143 # (is_loading=True) and second time when loading ends
152144 # (is_loading=False).
@@ -158,10 +150,6 @@ def OnLoadingStateChange(self, browser, is_loading, **_):
158150
159151class DisplayHandler (object ):
160152 def OnConsoleMessage (self , browser , message , ** _ ):
161- # Issue #344 will fix this in next release, so that client
162- # handlers are not called for Developer Tools windows.
163- if browser .GetUrl ().startswith ("chrome-devtools://" ):
164- return
165153 # This will intercept js errors, see comments in OnAfterCreated
166154 if "error" in message .lower () or "uncaught" in message .lower ():
167155 # Prevent infinite recurrence in case something went wrong
0 commit comments