FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/examples/snippets/onbeforeclose.py at cefpython66 · 2php/cefpython · GitHub
2php
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
examples
/
snippets
/
onbeforeclose.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (19 loc) · 644 Bytes
Breadcrumbs
cefpython
/
examples
/
snippets
/
onbeforeclose.py
Copy path
File metadata and controls
26 lines (19 loc) · 644 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
"""
Implement LifespanHandler.OnBeforeClose to execute custom
code before browser window closes.
"""
from
cefpython3
import
cefpython
as
cef
def
main
():
cef
.
Initialize
()
browser
=
cef
.
CreateBrowserSync
(
url
=
"https://www.google.com/"
,
window_title
=
"OnBeforeClose"
)
browser
.
SetClientHandler
(
LifespanHandler
())
cef
.
MessageLoop
()
del
browser
cef
.
Shutdown
()
class
LifespanHandler
(
object
):
def
OnBeforeClose
(
self
,
browser
):
print
(
"Browser ID: {}"
.
format
(
browser
.
GetIdentifier
()))
print
(
"Browser will close and app will exit"
)
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL