Python Forum
Show HTML in Python application and handle click
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Show HTML in Python application and handle click
#1
I know how to do this using C#. C# has a WebBrowser class and later classes.

I want to show a HTML file in a Python application, not in a browser (not in the usual manner) and process a click event locally in Python. The reason I need to do that is that copying to the clipboard is highly restricted in browsers.

Doing this would require a Python module that hosts the browser in the application; that is how Microsoft does it for the WebBrowser class and such. In the past I researched something like that (not using Python) but I forget if I found much.

I am trying to avoid being unnecessarily detailed so I apologize if I am not clear. Does something such as that exist for Python? If so then what?

Oh, yeah; I forgot about IronPython. I could probably use it if I can get it to work in my system. Update: I got IronPython to work so I will try it.
Reply
#2
(Sep-28-2021, 04:19 AM)SamHobbs Wrote: I want to show a HTML file in a Python application, not in a browser (not in the usual manner) and process a click event locally in Python
Look at pywebview, Flexx,and can search electron python.
GUI toolkit Like PyQt(Webkit) and WxPython(WebView)has build support for render HTM/CSS.
(Sep-28-2021, 04:19 AM)SamHobbs Wrote: The reason I need to do that is that copying to the clipboard is highly restricted in browsers.
Yes,but would look into this is really needed maybe and other way,
then i would use more normally web-development approach eg for me this would be using Flask.
Reply
#3
Flask might be useful if I wanted to develop an application; multiple pages that work together. I just need to support one page; the equivalent of using HTML as a word-processing format and Python for the macros. Flexx is by its definition also for applications.

Opinion: I think some day the internet will get a new design that allows internet applications to work more like desktop applications; I think desktop applications that work like internet applications are the wrong direction, although the compatibility/portability issue is useful.

Javascript API | pywebview appears to be an example of what I need to do. The example in RkBlog :: WebKit in PyQt - rendering web pages also appears relevant. wx.html2.WebView — wxPython Phoenix 4.1.2a1 documentation says it can be built to use Chromium (the current) Edge and that can be useful. So all of those are possibilities.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can I develop a live video streaming application using python? mtrkhan 3 4,378 Nov-15-2021, 10:42 PM
Last Post: Larz60+
  show csv file in flask template.html rr28rizal 8 34,524 Apr-12-2021, 09:24 AM
Last Post: adamabusamra
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,530 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Python Desktop Application that will connect o Azure SQL Database thewolf 7 4,441 Feb-26-2021, 01:33 AM
Last Post: thewolf
  Log In Button Won't Click - Python Selenium Webdriver samlee916 2 3,770 Jun-07-2020, 04:42 PM
Last Post: samlee916
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,329 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  Handle parameters in POST request for python webserver? JBristow1729 1 7,656 Jul-16-2019, 10:59 PM
Last Post: scidam
  Excel Like Web Application using Python ravsha85 1 2,274 Jun-13-2019, 06:00 PM
Last Post: noisefloor
  Click Element if displayed using Selenium and Python giaco__mar 1 3,488 Dec-27-2018, 06:19 PM
Last Post: metulburr
  Application like simpler facebook wall in python framework seidman 1 3,273 Mar-11-2018, 05:07 PM
Last Post: wavic

Forum Jump:

User Panel Messages

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