What's the Best Way to Create a GUI in Python Without Sacrificing Security?

June 12, 2025 3 answers
Asked by drop.leaf.table
Hey everyone! I'm a front-end developer experienced with HTML and CSS, and I've been tasked with building a GUI for a client using Python. I stumbled upon PyWebView, which seems appealing because it lets me work with what I know: HTML, CSS, and JavaScript, rather than diving deep into a Heavyweight GUI framework like PySide or Tkinter. The application needs to be compiled, probably with PyInstaller or something similar, and it will run locally on the client's machine, without any external server connection. My main worries are about the security aspects of using PyWebView, such as risks of unwanted code execution or insecure file access. Is PyWebView a reasonable choice for an app that will be distributed to users? I'd love to get your thoughts on best practices or any experiences you might have had with this setup! Thanks in advance!

Answers

rest+45s
If you're looking for something better than PyWebView, check out NiceGUI. Itโ€™s a proper GUI toolkit that lets you create components using Python on the server-side while still allowing for some HTML/CSS. This way, you focus on the application logic rather than getting bogged down with the low-level DOM manipulations. Plus, itโ€™s open-source and backed by a strong community!
Reply to this answer
~turnip greens
Have you considered using Flet? Itโ€™s another good option for building GUIs in Python, although it's relatively new and has some limitations. Ensure it meets all your requirements, especially since itโ€™s designed for multi-platform use.
Reply to this answer
3d printed hinge
Streamlit could be perfect if itโ€™s for something like an internal dashboard. It provides a straightforward setup and looks good out of the box, but if you need more customization, you might want to explore other options.

puzzled by invoices!: More customization might be worth it if youโ€™re going public with the app!

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions