MCPcopy Create free account
hub / github.com/cztomczak/cefpython / OnClose

Method OnClose

examples/wxpython.py:201–226  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

199 self.browser.NotifyMoveOrResizeStarted()
200
201 def OnClose(self, event):
202 print("[wxpython.py] OnClose called")
203 if not self.browser:
204 # May already be closing, may be called multiple times on Mac
205 return
206
207 if MAC:
208 # On Mac things work differently, other steps are required
209 self.browser.CloseBrowser()
210 self.clear_browser_references()
211 self.Destroy()
212 global g_count_windows
213 g_count_windows -= 1
214 if g_count_windows == 0:
215 cef.Shutdown()
216 wx.GetApp().ExitMainLoop()
217 # Call _exit otherwise app exits with code 255 (Issue #162).
218 # noinspection PyProtectedMember
219 os._exit(0)
220 else:
221 # Calling browser.CloseBrowser() and/or self.Destroy()
222 # in OnClose may cause app crash on some paltforms in
223 # some use cases, details in Issue #107.
224 self.browser.ParentWindowWillClose()
225 event.Skip()
226 self.clear_browser_references()
227
228 def clear_browser_references(self):
229 # Clear browser references that you keep anywhere in your

Callers

nothing calls this directly

Calls 3

_exitMethod · 0.80
DestroyMethod · 0.45

Tested by

no test coverage detected