cefpython icon indicating copy to clipboard operation
cefpython copied to clipboard

WindowInfo properties should be private

Open dtamade opened this issue 8 years ago • 2 comments

br_WindowInfo = cef.WindowInfo()
br_WindowInfo.SetAsChild(0)
br_WindowInfo.windowRect = [100, 100, 200, 200]
br_WindowInfo.windowName = 'CefAPP'
br = cef.CreateBrowserSync(br_WindowInfo, br_settings, url="https://www.url.com/"')

why?

dtamade avatar Mar 30 '17 14:03 dtamade

Please ask questions on the Forum. Do not set properties on the WindowInfo object, these should be private. Use second parameter to SetAsChild() to set window rect, see: https://github.com/cztomczak/cefpython/blob/master/api/WindowInfo.md#setaschild

cztomczak avatar Mar 30 '17 18:03 cztomczak

It turns out matter is more complicated. On Windows when you set parent window handle to 0 then SetAsPopup() is being called which doesn't accept window rect in upstream CEF. The only solution I see in the hello_world.py example would be to use CEF views (Issue #252) which allows for more customization, however currently CEF views don't allow for synchronous browser creation which again complicates matters, because some of CEF Python code currently depends on synchronous creation. You could either use some other example that depend on third party GUI framework and have apis for setting window size. Or you could handle just the Windows case by using PyWin32 extension to resize window after it is created.

cztomczak avatar Mar 30 '17 19:03 cztomczak