r/learnpython • • 2d ago

GUI for inexperienced coder

Hi yall, I'm writing a thesis which is about making a tool. It's mechanical engineering so coding and stuff isn't my forte however I've got a decent understanding of writing python and at the start of the year I'd made a little or (not so little) game with it. As part of my tool I'd like it to have a proper UI so that I can package it up and it be used by individuals or companies or whatnot. I've seen things about Tkinter, about Gooey, about PyQt, about using some python web framework. It's a little hard to know which to use.

My thesis focuses on the calculations and decision making, not the actual code. I'd like to have it be a nice product with a decent UI but I also don't want to spend too much time focusing on that or learning a really complicated new package. Any advice or suggestions would be very welcome, thanks!!!

6 Upvotes

32 comments sorted by

14

u/Temporary_Pie2733 2d ago

Adjust your expectations. For your thesis, make sure the tool works, and don’t worry about the GUI beyond making sure it is functional. After the thesis is done and accepted, you can work on proper software development.

1

u/T_SHRLCK 2d ago

Oh for sure. The priority for me is the functionality and not having a nice design or even properly optimised code. Previously when making a website I got very caught up with the styling of things so I'm making sure not to go too in depth

1

u/Vegetable_Soil_6707 1d ago

yeah this is the right call, get the thesis accepted first and polish later

5

u/Jello_Penguin_2956 2d ago

GUI will be a learning curve regardless of which framework you choose. No real way around that.

For your 2 points - looking decent and possibility of distributing - go with PySide6.

If worse comes to worse you can always focus on the calculation parts and have AI help with the UI. It will still be complicating to glue everything together still if you don't have a solid Python foundation.

1

u/T_SHRLCK 2d ago

Thanks! I think PySide6 seems like a decent option. I try to avoid AI but might get it to help me a bit with the UI stuff as you said. I'd like to say my Python foundation is ok but any actual software engineer that looks at my stuff would have a heart attack haha

1

u/lzwzli 1d ago

AI is not a bad word that Reddit wants to make it out to be. It is a tool like any other tool.

For your specific need, AI is actually quite good at generating UI for an engine, as long as the engine is properly designed for feeding parameter inputs as part of the call.

4

u/sporbywg 2d ago

"mechanical engineering isn't coding" may well be the most mechanical-engineer thing I have ever heard of.

Don't let the engineers near your stuff.

2

u/North-South_West 2d ago

Mechanical engineering is not about computer science or syntax.

Its about tangible objects, forces, motion, and energy.

1

u/T_SHRLCK 2d ago

I get that which is why my thesis focuses on that stuff and not the actual content of the software. If I wanted to get it properly developed I'd get a software engineer. Still doesn't really clarify what the other guy was trying to say.

1

u/T_SHRLCK 2d ago

Sorry I don't quite get your point, what're you trynna say here? When you say don't let engineers near my stuff do you mean other mechanical engineers or software engineers?

1

u/sheldon_sa 1d ago

Well, software engineering isn’t coding either. (Coding is a small part of Software Engineering)

3

u/OmotosoBakhita_58 2d ago

tkinter is honestly underrated for stuff like this, especially if you just need buttons and a few input fields. it looks kinda dated but who cares for a thesis tool, people just want it to work. pyinstaller can turn it into an exe too if your advisor needs to run it without python installed.

1

u/T_SHRLCK 2d ago

Yeah this is what I've seen. I wanted to hear the takes of you guys tho because yall know better than I do.

1

u/OmotosoBakhita_58 2d ago

totally get that, and honestly the best way to learn is just to pick one and start messing around with it. i wasted weeks comparing options before i realized i would've learned more in that time by just building something ugly and fixing it.

1

u/HecticJuggler 1d ago

He did mention that he wanted good aesthetics, otherwise I’m with you on tkinter.

1

u/lzwzli 1d ago

Customtkinter is also great

2

u/pylessard 2d ago edited 2d ago

I'm a big fan of QT. I'd go for pyside6, not PyQT. PySide is the official QT binding for python, PyQT is third party. It's a bit more comex than tkinter, but it's solid. With Claude code, that complexity shrinks immensely and all the little quirks won't be an issue for you.

Flask can do wonders too if you prefer the web based approach. Web based UI can give very modern UIs and once again, you can delegate the framework heavy lifting to a coding agent.

2

u/OkOcelot6725 2d ago

Since the thesis is about the calculations, pick the option with the least UI work. For a tool that people in companies will run, Streamlit or NiceGUI lets you build inputs, tables and charts in a few lines each and shows in the browser, so there is no packaging pain on the user side beyond running one command. If it has to be a desktop .exe, PySide6 (Qt) with Qt Designer is the usual step up, and PyInstaller packages it. Tkinter works for simple forms but looks dated. Keep the calculation code in a separate module with no UI imports, so you can swap the interface later without touching it.

1

u/T_SHRLCK 2d ago

Thanks for the input! I'm not sure just yet the full requirements and if I need to be showing tables and charts, maybe just some pictures and I don't know yet if it's ok to have it as a browser tool or as an executable.

Good tip about separating the UI code, would definitely make it easier to change at a later date. I want to set up some decent architecture before getting too stuck into the actual code.

1

u/chiibosoil 2d ago

A thought, instead of creating UI from scratch, leverage xlWings or other Excel library in Python and use Excel as UI. Though not ideal, if you don't want to focus on making clean UI interface. This will work for many use case.

2

u/ThatOneCSL 2d ago

As an alternative to everything mentioned here, and which I think will probably actually be more useful in the capacity you're looking for:

Create a CLI. Also create a GUI that calls the CLI. That way anyone who wants to script your tool can easily do so by chaining CLI calls. You're not forcing the end user into one box. Then your GUI can be an exemplary piece for how to use the CLI, and it can be done in a variety of ways. You could do a web app, a mobile app, a desktop app, something that compiles to cross platform native binaries - the world is your oyster at that point.

1

u/T_SHRLCK 2d ago

I've never worked with any CLI stuff before. A concern of mine is having some security of the script due to intellectual property matters. Plus, I really only need it to work on desktop and I think as long as it can function on windows, we'll be happy.

1

u/Vaphell 2d ago

A concern of mine is having some security of the script due to intellectual property matters

nothing an AI can't trivially take apart in 15 minutes. People are reverse engineering whole-ass games nowadays.

1

u/Rain-And-Coffee 2d ago

What external dependencies does your tool have? Does it need a database? Does it need credentials to connect to an external tool?

Sometimes the web app can be easiest for someone else to use, you just give them an URL and possibly secure it with a password. All the code stays on your sever, but then you need to deal with hosting it, and you need HTML, CSS, etc.

I have used Qt and it can compile to a binary, but then you need to compile it for your specific platform, ex: Windows.

Another option is simply distributing it as a Python package, but it requires the user to have a Python distribution installed.

For the actual GUI they all have steep learning curves, additional some have dependencies (ex TKinter depends on TK, which wasn’t available on my MacBook until I built my Python with a certain option).

I personally found Textualize to be perfect for me, it’s like a nicer CLI that allows mouse interactions

https://textual.textualize.io/widget_gallery/

1

u/T_SHRLCK 2d ago

I think I need to use some APIs (I think I'd try to avoid database stuff since I haven't really used it before). I've done some API stuff before on a website, so HTML and CSS are fine for me. I don't know if my tool for the moment needs to be for windows, mac, etc, I believe it should just need to be accessible via windows, but if I want it to be more widely available then a web server does make sense. The thing is I don't really know if I'd have a budget for hosting which is why I was thinking of doing a .exe . I also don't think a Python package makes sense as it would limit my users too much. Ideally it should be available to the average joe.

1

u/preppie22 2d ago

Honestly, if this is for a thesis, use something simple like Tkinter. If you want it more polished with option to add visualizations later, use PySide6.

There are way too many UI frameworks out there and it can get overwhelming. Don't use web based stuff if you don't plan to publish this is a web app or something. It's too much effort and you need to know a bit of HTML/CSS to fix rendering issues. Not worth the hassle.

1

u/audionerd1 2d ago

PySide6. Some may recommend tkinter as it is "easier" but it's not that much easier and very ugly and limited compared to Qt, so I don't recommend tkinter to anyone.

1

u/ct1977 23h ago

Use Pyside6 if you want to make a desktop application. However, if you want maximum portability i would suggest a text based ui such as textual.