FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/examples/snippets/window_size.py at cefpython66 · PythonNexus/cefpython · GitHub
PythonNexus
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
examples
/
snippets
/
window_size.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (33 loc) · 1.28 KB
Breadcrumbs
cefpython
/
examples
/
snippets
/
window_size.py
Copy path
File metadata and controls
38 lines (33 loc) · 1.28 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
"""
Set initial window size to 900/640px without use of
any third party GUI framework. On Linux/Mac you can set
window size by calling WindowInfo.SetAsChild. On Windows
you can accomplish this by calling Windows native functions
using the ctypes module.
"""
from
cefpython3
import
cefpython
as
cef
import
ctypes
import
platform
def
main
():
cef
.
Initialize
()
window_info
=
cef
.
WindowInfo
()
parent_handle
=
0
# This call has effect only on Mac and Linux.
# All rect coordinates are applied including X and Y parameters.
window_info
.
SetAsChild
(
parent_handle
, [
0
,
0
,
900
,
640
])
browser
=
cef
.
CreateBrowserSync
(
url
=
"https://www.google.com/"
,
window_info
=
window_info
,
window_title
=
"Window size"
)
if
platform
.
system
()
==
"Windows"
:
window_handle
=
browser
.
GetOuterWindowHandle
()
insert_after_handle
=
0
# X and Y parameters are ignored by setting the SWP_NOMOVE flag
SWP_NOMOVE
=
0x0002
# noinspection PyUnresolvedReferences
ctypes
.
windll
.
user32
.
SetWindowPos
(
window_handle
,
insert_after_handle
,
0
,
0
,
900
,
640
,
SWP_NOMOVE
)
cef
.
MessageLoop
()
del
browser
cef
.
Shutdown
()
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL