Python UI questions

So… I have been learning JavaScript mainly because of creating websites… and along with it there is HTML and CSS…

Now… I DO NOT want to create websites with Python… I am more interested in stand alone software for different applications…

QUESTION:
How do you create the User Interface for Python??? what would be the equivalent of HTML and CSS to create different things with Phyton?

For creating games??? can I use SVG drawings?

Customer tracking information… for order, shipments, calls, emails, etc… could I integrate that with excel and save the documents???

Now that I am feeling a bit more confident building websites… now I want to build a bunch of software for different things… but the little introduction that I have on Python looks more like JavaScript without the HTML and CSS…

By looking for a Python library for making a GUI - “Graphical User interface”. There are a couple out there and all you need to know for design and whatnot will be in tutorials and documentations.
You might also just something like Flask to use the browser to render the program. This way you can utilize HTML and CSS. And there is no issue with using a browser to interact with a program, as it might make a lot of things easier compared to create a complete standalone application. I mean, you got a browser anyway, why not use it?

Same for games: look for a fitting library. The most known would be Pygame, but there are others as well. And again it’s up to the libary as to what you can and cannot use. They most likely support all standard graphics formats including SVG, PNG, JPG…

Saving data? Sure, find a fitting library. The basic format to save data is CSV though. You can import those into Excel. For advance data processing something like Numpy or Pandas might come to mind. I know Pandas can also save directly to Excel-files, but you need to install some additional dependancy. You might also want to look into SQL if you intent on working with more complex databases.

Python is an extremly powerful tool thanks to the abundance of libraries for all kinds of things and the fact you can easily install them with PIP and even create virtual environments without a lot of hassle.

If you want to write more complex programs, I also recommend looking into how to make file structures and create your own modules for imports. Not that it’s hard - you basically add a __init__.py file to a folder.

Well… that sounded interesting… I know Python has a lot of applications other than just websites… if it isn’t a website, what kind of applications could I put in Flask to use the browser?

HTML and CSS (and JS) if you want to interact with something over the web, ie you want to create applications that are accessed in a browser (not just websites per se), just the same, that doesn’t change.

For desktop applications, search GUI framework, there are Python bindings for every major framework (iirc tkinter comes with the Python stdlib, you should be able to build desktop apps out-of-the-box).

Pygame is the most common game engine, for hobbyist/learning mostly (might come OOTB with standard installs as well??). Panda3D seems to have a good reputation (has a very good shader tutorial anyway, which is the only reason I know about it, but people seem to think it’s v good).

SVG is a format for transferring vector drawings, supported natively on the web – it’s not super common to use it directly but lots of tools can take vector art in SVG and process it to something usable.

Flask is a web framework, it’s a layer that gives you a load of programming tools to make it easy to access functionality via the web. You write your application code against Flask to do {something}, and you’ve then got access to things like routing (“when your server is running, if a user hits some web address, run {some code} and return {something} to them”). You could return HTML, and Python has several templating languages which make it easy to build HTML. You could return JSON, and have some JS app that the user uses in a browser talk to your Flask app. Etc.

2 Likes

Anything you want. Jupyter-notebooks is an IDE that just uses the browser but runs completly lokally.

A “browser” for the most part is just a program that can render HTML, CSS, execute JS and send-and-receive requests over the internet.
However you don’t “NEED” to use the internet to use a browser.
For example Microsoft Edge is the standard PDF-reader on windows.

Meaning you can do a lot of stuff with a browser.
While I haven’t really looked into it, I would assume this makes developing a program a lot easier. Pretty much everyone has a browser, so relying on it as GUI saves on development and makes for smaller programs as you just include some html and css. That said, it’s also more expensive on the user side because as the browser can do a lot of things, this means it will eat up a lot of RAM just for being ready to do these things.

1 Like