Andereoo / TkinterWeb

Python bindings for Tkhtml.
MIT License
146 stars 16 forks source link

Selenium support (Making Contact) #101

Closed TinTin-Esoterico closed 1 month ago

TinTin-Esoterico commented 2 months ago

Hey! Thanks a lot for your service, this is amazing, really.

I am here to ask if there is a way to put a Selenium Webdriver Window inside TKinter Frame, my GUI will need this, I found a lot of ways to start and interact with selenium using TKinter but found nothing about how to display it inside a Widget... Thanks. If opening a Issue for this bothers you I can remove, whatever will be the best for you. Again, thanks a lot and good job

Andereoo commented 2 months ago

Hi! No worries, happy to help. Selenium doesn't include a GUI. You can interact with a webpage via code with Selenium but you can't display the webpage and allow the user to interact with it graphically. The closest thing you can do is get the html source code from Selenium and display that in Tkinterweb as a static page.

TinTin-Esoterico commented 2 months ago

I'm having so many issues trying to use CEFPython (even with Py3.9) that I'm really considering this solution.

I can add buttons that makes the actions and refresh the static html. Thanks Andereoo

Andereoo commented 2 months ago

No worries! It is also possible to replace HTML elements with Tkinter widgets, so you could also inject your own buttons into the webpage itself (i.e. replace one of the webpage's buttons with your own, which would then interact with Selenium, etc.). See Geometry Management with TkinterWeb . Whether this is reasonable or not depends on your app's needs, but it is nonetheless another potential solution. I'd be happy to answer any questions you might have with that!

TinTin-Esoterico commented 2 months ago

You're the best, really

Thanks Andereoo