(Aug-30-2021, 08:26 PM)deanhystad Wrote: This is the important part:
window_info.SetAsChild(self.get_window_handle(), rect)This tells the browser to make it's window to a child of the Frame window. Most of the rest of the code in BrowserFrame is telling the BrowserFrame how to be a parent of a browser. Let the browser know when the window changes size or is moved. Let the browser know when the frame gets or loses focus. Let the browser know when the frame goes away. I don't think there is a much simpler way to do all that than the example code. Usually tkinter creates all the windows and everything that BrowserFrame does takes place behind the scenes.
What parts in particular do you find confusing?
im having dificulties specifing the frame where the browser window opens.
for example:
root = Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
leftfrm = LabelFrame(root, text="", padx=5, pady=5, highlightbackground="black",highlightthickness=2)
leftfrm.grid(row=0, column=0, sticky='ne', pady=2)
#i whant the browser to open in this frame
home_browser = LabelFrame(root, text="", padx=5, pady=5, highlightbackground="black",highlightthickness=2)
home_browser.grid(row=0, column=1, sticky='ne', pady=2)
rightfrm = LabelFrame(root, text="", padx=5, pady=5, highlightbackground="black",highlightthickness=2)
rightfrm.grid(row=0, column=2, sticky='ne', pady=2)
preferebly called by a function, for example:
func_open_browser("home_browser", "http://www.google.com")
thanks
this code also works for me i gues it would be easier to implement.
from cefpython3 import cefpython as cef import platform import sys def main(): check_versions() sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error cef.Initialize() cef.CreateBrowserSync(url="https://www.google.com/", window_title="test") cef.MessageLoop() cef.Shutdown() def check_versions(): assert cef.__version__ >= "55.3", "CEF Python v55.3+ required to run this" if __name__ == '__main__': main()