Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Creating desktop application with HTML GUI [closed]

Tags:

python

This question is more about methodology.

I want to create a Python desktop application, but I don't want its GUI to be like tkinter or like PyQt. I prefer to have a beautiful and modern client GUI like Bootstrap.

Is there any existing API for creating such applications in Python?

If not: does it sound a sane workround to use some Python server (like Django or like web2py), and to start a new server each time the application is launched by a user, just for enabling the application core to be in Python and the client to be in HTML? Does anyone work this way?

like image 285
SomethingSomething Avatar asked Sep 09 '15 15:09

SomethingSomething


People also ask

Can you make a Python GUI with HTML?

As you can see, you would be able to create your whole GUI using HTML, we just must add <script type="text/javascript" src="/eel. js"></script> , this script will allow us to call our exposed python functions. We have completed our graphical user interface, now, we must create our python file.

Is Python good for desktop GUI?

Python is fully capable of GUI development as well. That's precisely what we've covered in this post. The five tools we discussed here are helpful for almost all the GUI development needs. From prototyping to mobile app releases to Google and iOS stores to Web applications.

Is PyQt good for desktop application?

Compared to Electron and JavaScript, PyQt5 might not be the popular tool to build desktop apps, but it's very effective. Web apps are very popular, but there are still times when only a desktop app can deliver a great user experience.

Can you make a desktop app with HTML?

Electron can be used to build Desktop Apps with HTML, CSS and Javascript. Also these apps work for multiple platforms like Windows, Mac, Linux and so on. Electron Combines Chromium and NodeJS into a single Runtime. This enables Us to run the HTML, CSS and Javascript Code as a desktop application.


1 Answers

Use PyQt or PySide 2, Qt WebEngine and Qt's builtin support for hosting HTML applications:

http://doc.qt.io/qt-5/qtwebchannel-index.html

The general architecture is a SPA (Single Page Application) running from local HTML and Javascript content bundled with your app – no need for bundling in a web server.

For anything complicated (like bypassing cross origin issues), use the Qt WebChannel to message to functionality built on the Python side.

This is basically the same architecture that Cordova uses.

Now, whether you should build an application this way (cough QML cough) is a completely different topic.

like image 95
David K. Hess Avatar answered Oct 11 '22 05:10

David K. Hess