A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cztomczak/cefpython/issues/349 below:

wxPython's GetHandle() returns 0 with wxPython 3.0/4.0 on Linux · Issue #349 · cztomczak/cefpython · GitHub

On Linux with wxPython 3.x / 4.x window handle is not yet available even though Show() was called and it causes in the wxpython.py example to open two windows, one blank window and another window with CEF browser. This effect is because window handle passed to CEF is 0, thus CEF creates a top-level window on its own.

The solution is to delay embedding browser by a bit and window handle becomes available then. Time of 1ms is not enough, 10ms seems fine, but to be sure I've used 20ms. Example works fine with such code:

        # On Linux must show before embedding browser, so that handle
        # is available (Issue #347).
        if LINUX:
            self.Show()
            # In wxPython 3.0 and wxPython 4.0 handle is still
            # not yet available, must delay embedding browser
            # (Issue #349).
            if wx.version().startswith("3.") or wx.version().startswith("4."):
                wx.CallLater(20, self.embed_browser)
            else:
                # This works fine in wxPython 2.8
                self.embed_browser()
        else:
            self.embed_browser()
            self.Show()

Issue originally reported on the Forum:
https://groups.google.com/d/topic/cefpython/ZBXEdOR3svw/discussion


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4