3

I realize this is likely a pipe dream, but I'm asking it here just in case.

What I want is a library that provides a GUI widget. Ideally this would be a widget that can be used in apps using some widely-supported GUI toolkit (like Qt). But if it just displays a GUI on its own, that's fine (as long as it will work on Windows, Mac and Linux).

I want this GUI widget to render HTML/CSS. That is, I want to be able to provide HTML and CSS to this widget and have it render it in a GUI window.

The real rub is that I want to be able to access and manipulate the DOM from outside the widget, but have the widget respond to my manipulations by updating the display appropriately. The ideal widget would have a pluggable DOM interface that can be easily "bound" to a variety of languages. But the one I really want to use is Python, so that's the highest priority. So I want to be able to write code in Python that can query the DOM, edit it, manipulate it, respond to events from it, etc. I don't care if the API I use to interact with the DOM is the official W3C DOM API, and in fact that API is convoluted enough that it might be better to have something higher-level.

I do not want the widget to have "browser chrome". I just want it to render the HTML/CSS. I don't need the widget to support JavaScript; in fact, it would be preferable if it did not, because I don't want the widget to deal with executable code inside its contents. I just want it to render the HTML/CSS.

The big difference between what I'm asking for here and things like QtWebEngine is that, as far as I can tell, those are essentially embedded browsers. I don't want a browser. I want a widget that takes HTML and CSS, renders it, keeps track of the DOM, and exposes the DOM to an external app (the app that the widget is running inside) so that that app (and not the browser engine) can interact with the DOM.

In other words, as you may have guessed, I want to do everything I can do on a web page, but I want to do it without ever using JavaScript or a web browser. Also, I want to do it by embedding the HTML renderer in my app, so that the rendered GUI is a reflection of whatever DOM operations I do from within my app code. Again, as far as I can tell, existing solutions either require me to do the reverse (embed my app in a browser by writing in it in JavaScript), or they embed a browser rather than a programmable rendering engine, so that doing any kind of operation on the DOM involves telling the browser to do it rather than just doing it in external code and having the rendering update directly.

In short, I want something that allows me to treat individual DOM elements the same way I would treat individual widgets in a GUI toolkit like Qt: as objects that can be addressed, manipulated, queried, and responded to from arbitrary code in a language with bindings for the HTML "toolkit".

Oh, and I want it to be free. After everything else, that's not so much to ask, is it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.