How to call cef.CreateBrowserSync()

651 Views Asked by At

I'm attempting to use cefpython3 with tkinter and want to make it OOP. Right now I have 3 classes GUI which act as the controller (runs tk.Tk()) and controls what page is showing. Next is a MainPage class which holds all the pages parts; buttons, labels, and a Browser object. The third class is a BrowserFrame class which is based on the tkinter example on cefpython's tutorial page on GitHub.

I'm getting the error AssertionError: cefpython.CreateBrowserSync() may only be called on the UI thread. What is the UI thread? The documentation only explains that it must be called in the UI thread but with no explanation on what the UI thread is.

1

There are 1 best solutions below

2
Emerson Maki On

It sounds like you have called cef.Initialize() in a different section of your code from where you are attempting to call cef.CreateBrowserSync()

cef.Initialize() is what begins the UI thread. See here