3

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.

LukeDev
  • 509
  • 4
  • 19

1 Answers1

0

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

Emerson Maki
  • 44
  • 1
  • 5
  • I did that on purpose. Is there a way to call them in different places? – LukeDev Nov 04 '22 at 14:10
  • @LukeDev They can be called in different files, but the main Python process loop which contains the .Initialize() must also call the .CreateBrowserSync() function. If they are in different loops, it will not work. I believe we can solve this issue if you provide some example code of your problem. – Emerson Maki Nov 07 '22 at 14:46