Python Forum
[Tkinter] can i had a cefpython3 to a labelframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] can i had a cefpython3 to a labelframe
#5
(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()
Reply


Messages In This Thread
can i had a cefpython3 to a labelframe - by razs - Aug-28-2021, 10:47 AM
RE: can i had a cefpython3 to a labelframe - by razs - Aug-31-2021, 08:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter destroy label inside labelFrame Nick_tkinter 3 4,672 Sep-17-2023, 03:38 PM
Last Post: munirashraf9821
  Issue in Tkinter with winfo_class() and LabelFrame ReDefendeur 1 2,795 Oct-05-2020, 05:52 AM
Last Post: Jeff900

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020