How to use the cefpython3.cefpython.WindowInfo function in cefpython3

To help you get started, we’ve selected a few cefpython3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cztomczak / cefpython / examples / qt.py View on Github external
def embedBrowser(self):
        if (PYSIDE2 or PYQT5) and LINUX:
            # noinspection PyUnresolvedReferences
            self.hidden_window = QWindow()
        window_info = cef.WindowInfo()
        rect = [0, 0, self.width(), self.height()]
        window_info.SetAsChild(self.getHandle(), rect)
        self.browser = cef.CreateBrowserSync(window_info,
                                             url="https://www.google.com/")
        self.browser.SetClientHandler(LoadHandler(self.parent.navigation_bar))
        self.browser.SetClientHandler(FocusHandler(self))
github cztomczak / cefpython / src / windows / deprecated_32bit / pywin32.py View on Github external
win32con.WM_ERASEBKGND: cefpython.WindowUtils.OnEraseBackground
    }

    browserSettings = dict()
    browserSettings["universal_access_from_file_urls_allowed"] = True
    browserSettings["file_access_from_file_urls_allowed"] = True

    if os.path.exists("icon.ico"):
        icon = os.path.abspath("icon.ico")
    else:
        icon = ""

    windowHandle = cefwindow.CreateWindow(title="pywin32 example",
            className="cefpython3_example", width=1024, height=768,
            icon=icon, windowProc=wndproc)
    windowInfo = cefpython.WindowInfo()
    windowInfo.SetAsChild(windowHandle)
    browser = cefpython.CreateBrowserSync(windowInfo, browserSettings,
            navigateUrl=GetApplicationPath("example.html"))
    cefpython.MessageLoop()
    cefpython.Shutdown()
github cztomczak / cefpython / src / linux / binaries_64bit / deprecated / wxpython.py View on Github external
# the menu not to work.
        # --
        # You also have to set the wx.WANTS_CHARS style for
        # all parent panels/controls, if it's deeply embedded.
        self.mainPanel = wx.Panel(self, style=wx.WANTS_CHARS)

        # Global client callbacks must be set before browser is created.
        clientHandler = ClientHandler()
        cefpython.SetGlobalClientCallback("OnCertificateError",
                clientHandler._OnCertificateError)
        cefpython.SetGlobalClientCallback("OnBeforePluginLoad",
                clientHandler._OnBeforePluginLoad)
        cefpython.SetGlobalClientCallback("OnAfterCreated",
                clientHandler._OnAfterCreated)

        windowInfo = cefpython.WindowInfo()
        # Must show window otherwise GetHandle() returns 0
        self.Show()
        cefpython.WindowUtils.InstallX11ErrorHandlers()
        windowInfo.SetAsChild(self.mainPanel.GetHandle(),
                              [0,0,0,0])
        # Linux requires adding "file://" for local files,
        # otherwise /home/some will be replaced as http://home/some
        self.browser = cefpython.CreateBrowserSync(
            windowInfo,
            # If there are problems with Flash you can disable it here,
            # by disabling all plugins.
            browserSettings=g_browserSettings,
            navigateUrl=url)

        clientHandler.mainBrowser = self.browser
        self.browser.SetClientHandler(clientHandler)
github cztomczak / cefpython / examples / snippets / window_size.py View on Github external
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()
github RimoChan / Librian / librian / librian_util / wxcef.py View on Github external
def embed_browser(self, url):
        window_info = cef.WindowInfo()
        (width, height) = self.browser_panel.GetClientSize().Get()
        assert self.browser_panel.GetHandle(), "Window handle not available"
        if LINUX:
            handle_to_use = self.browser_panel.GetHandle()
            display = Gdk.Display.get_default()
            window = GdkX11.X11Window.foreign_new_for_display(display,handle_to_use)
            self.gtk_window = gtk_window = Gtk.Window()
            def callback(gtk_window,window):
                print("inside callback")
                gtk_window.set_window(window)
                gtk_window.set_visual( gtk_window.get_screen().lookup_visual(0x21))
            gtk_window.connect("realize",callback,window)
            gtk_window.set_has_window(True)
            gtk_window.show()
            sw = Gtk.ScrolledWindow()
            sw.show()
github cztomczak / cefpython / src / mac / deprecated_64bit / wxpython.py View on Github external
# the menu not to work.
        # --
        # You also have to set the wx.WANTS_CHARS style for
        # all parent panels/controls, if it's deeply embedded.
        self.mainPanel = wx.Panel(self, style=wx.WANTS_CHARS)

        # Global client callbacks must be set before browser is created.
        self.clientHandler = ClientHandler()
        cefpython.SetGlobalClientCallback("OnCertificateError",
                self.clientHandler._OnCertificateError)
        cefpython.SetGlobalClientCallback("OnBeforePluginLoad",
                self.clientHandler._OnBeforePluginLoad)
        cefpython.SetGlobalClientCallback("OnAfterCreated",
                self.clientHandler._OnAfterCreated)

        windowInfo = cefpython.WindowInfo()
        (width, height) = self.mainPanel.GetClientSizeTuple()
        windowInfo.SetAsChild(self.mainPanel.GetHandle(),
                              [0, 0, width, height])
        # Linux requires adding "file://" for local files,
        # otherwise /home/some will be replaced as http://home/some
        self.browser = cefpython.CreateBrowserSync(
            windowInfo,
            # If there are problems with Flash you can disable it here,
            # by disabling all plugins.
            browserSettings=g_browserSettings,
            navigateUrl=url)

        self.clientHandler.mainBrowser = self.browser
        self.browser.SetClientHandler(self.clientHandler)

        jsBindings = cefpython.JavascriptBindings(
github chanzuckerberg / cellxgene / server / gui / browser.py View on Github external
def embedBrowser(self):
        if LINUX:
            self.hidden_window = QWindow()
        window_info = cef.WindowInfo()
        rect = [0, 0, self.width(), self.height()]
        window_info.SetAsChild(self.getHandle(), rect)
        # TODO better splash
        self.browser = cef.CreateBrowserSync(window_info)
github alyvix / alyvix / alyvix / ide / viewer / windows.py View on Github external
win32con.WM_CLOSE: self.close_window_3,
            win32con.WM_DESTROY: self.exit_app,
            win32con.WM_SIZE: WindowUtils.OnSize,
            win32con.WM_SETFOCUS: WindowUtils.OnSetFocus,
            win32con.WM_ERASEBKGND: WindowUtils.OnEraseBackground
        }

        self._hwnd_1 = self.create_window(title="Alyvix Designer",
                                      class_name="alyvix.designer",
                                      width=800,
                                      height=800,
                                      window_proc=window_proc,
                                      icon="resources/chromium.ico",
                                      fullscreen=True)

        window_info = cef.WindowInfo()
        window_info.SetAsChild(self._hwnd_1)

        if father == "selector":
            self._hwnd_2 = self.create_window(title="Alyvix Selector",
                                          class_name="alyvix.selector",
                                          width=int(1300*scaling_factor),
                                          height=int(460*scaling_factor),
                                          window_proc=window_proc_2,
                                          icon="resources/chromium.ico",
                                          fullscreen=False)

            window_info_2 = cef.WindowInfo()
            window_info_2.SetAsChild(self._hwnd_2)

            self.hide(self._hwnd_1)
github cztomczak / cefpython / src / linux / binaries_64bit / wxpython-response.py View on Github external
def __init__(self):
        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
                title='wxPython CEF 3 example', size=(800,600))
        self.CreateMenu()

        # Cannot attach browser to the main frame as this will cause
        # the menu not to work.
        # --
        # You also have to set the wx.WANTS_CHARS style for
        # all parent panels/controls, if it's deeply embedded.
        self.mainPanel = wx.Panel(self, style=wx.WANTS_CHARS)

        windowInfo = cefpython.WindowInfo()
        windowInfo.SetAsChild(self.mainPanel.GetGtkWidget())
        # Linux requires adding "file://" for local files,
        # otherwise /home/some will be replaced as http://home/some
        self.browser = cefpython.CreateBrowserSync(
            windowInfo,
            # If there are problems with Flash you can disable it here,
            # by disabling all plugins.
            browserSettings={"plugins_disabled": False,
                    "default_encoding": BROWSER_DEFAULT_ENCODING},
            navigateUrl="file://"+GetApplicationPath("example.html"))

        clientHandler = ClientHandler()
        self.browser.SetClientHandler(clientHandler)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        if USE_EVT_IDLE:
github carlosperate / ardublockly / start_cef.py View on Github external
if not url:
            url = "http://localhost:8000/ardublockly/index.html"

        # Also have to set wx.WANTS_CHARS style for all parent panels/controls
        self.mainPanel = wx.Panel(self, style=wx.WANTS_CHARS)

        # Global client callbacks must be set before browser is created.
        self.clientHandler = ClientHandler()
        cefpython.SetGlobalClientCallback("OnCertificateError",
                self.clientHandler._OnCertificateError)
        cefpython.SetGlobalClientCallback("OnBeforePluginLoad",
                self.clientHandler._OnBeforePluginLoad)
        cefpython.SetGlobalClientCallback("OnAfterCreated",
                self.clientHandler._OnAfterCreated)

        windowInfo = cefpython.WindowInfo()
        windowInfo.SetAsChild(self.GetHandleForBrowser())
        self.browser = cefpython.CreateBrowserSync(
            windowInfo,
            browserSettings=g_browserSettings,
            navigateUrl=url)

        self.clientHandler.mainBrowser = self.browser
        self.browser.SetClientHandler(self.clientHandler)

        jsBindings = cefpython.JavascriptBindings(
            bindToFrames=False, bindToPopups=True)
        jsBindings.SetFunction("PyPrint", PyPrint)
        jsBindings.SetProperty("pyProperty", "This was set in Python")
        jsBindings.SetProperty(
            "pyConfig",
            ["This was set in Python",