1

I create a Browser:

browser = cef.CreateBrowserSync(url=os.path.dirname(os.path.abspath(__file__))+'\\gui.html', window_title="Title")

Is there any way to hide and show the window whenever I want?

Czarek Tomczak
  • 20,079
  • 5
  • 49
  • 56
wololo
  • 15
  • 5

1 Answers1

1

If you use the "wxpython.py" example then you can call MainFrame.Hide() to hide window and Show() to show it.

If using the "hello_world.py" example then you would need to make a native OS call using for example ctypes. For Windows the code would be:

import ctypes
SW_SHOW = 5
SW_HIDE = 0
hwnd = browser.GetWindowHandle()
ctypes.windll.user32.ShowWindow(hwnd, SW_HIDE)
ctypes.windll.user32.ShowWindow(hwnd, SW_SHOW)
Czarek Tomczak
  • 20,079
  • 5
  • 49
  • 56