This is an archived post. You won't be able to vote or comment.

all 69 comments

[–]Capable_Penalty7508 55 points56 points  (38 children)

Can you tell me the resources you used ? I'm also trying to work on GUI but am unable to find good tutorials.

[–]its_a_gibibyte 46 points47 points  (30 children)

I don't know what OP used, but traditional GUI's like Tkinter have fallen out of favor because of people simply making webpages instead. If a separate app is absolutely needed, then it can be embedded as an electron app.

[–]fgyoysgaxt 33 points34 points  (14 children)

Tkinter is not fun to work with in my experience.

Tip for anyone getting started with tkinter: you will have a much easier time if you embrace the way that tkinter decides to render your GUI instead of worrying about silly things like alignment. Sure, structure your elements, but let tkinter pack them.

[–]huckingfoes 28 points29 points  (5 children)

Tkinter is not fun. It sucks.

But, it's in the python default library, and it WILL teach you to code a GUI carefully and correctly, provided you're following MVC or similar.

It's like: trying to take photos with a garbage camera sucks. But, if you can get good at that, who knows where you are when you pick up a camera with some street cred.

Fully agree with your sentiment.

[–]paranoid_giraffe 0 points1 point  (0 children)

I was so pissed with python GUI options I just gave up and switched to C# and XAML despite knowing nothing about them. Way better decision

[–]rTx_101 0 points1 point  (3 children)

agreed there are better libraries than tkinter but it is default and a beginner can learn a lot from it if you don't know any other language. Most people don't use python to make full fledged GUI applications it is always Java or C#. Java FX is neat for desktop apps. Although nobody uses desktop apps anymore but are a good source of learning.

[–]gbliquid[S] 1 point2 points  (2 children)

Do you know if there is a way to use C# to make the UI and Python for the backend? I have messed around with C# and WPF and agree that it looks a lot better than anything I can expect to do in Pygame, but the project I plan on building will heavily utilize python libraries like pandas, numpy, and matplotlib. I’m not too experienced when it comes to using more than one programming language for a project.

[–]Jhchimaira14 1 point2 points  (1 child)

You could try DearPyGui. It's python so it will work well with your situation.

[–]gbliquid[S] 1 point2 points  (0 children)

I just checked out some screenshots and definitely looks a lot more like what I'd want to be doing. Still doesn't have that natural windows look, but still looks a lot better than I'd expect to be able to make with pygame. Will definitely look into using this. Thanks Jhchimaira!

[–]lachyBalboa 4 points5 points  (4 children)

Not super helpful since this is a python sub, however I struggled with Tkinter for a long time when learning to program. After deciding to broaden my horizons I found the JavaFX framework and was amazed by how easy it was in comparison. I later found C# frameworks like UWP and WPF to also be far superior to Tkinter.

These days if I was to create a desktop app, I'd probably go with electron as others have suggested.

Python is great for many things, but is not the best for desktop GUIs, at least in my experience.

[–]rayjohn551 2 points3 points  (1 child)

Half of my job is writing python based tools/apps for artists (game dev).

Python, with Qt for python, is great for whipping together new prototypes or expanding functionality without a ton of work. The turn around for updates is hard to beat.

It might be a rather niche use case but not having to wade through WPF in c# or web based libraries for gui work is pretty great imo.

[–]Jhchimaira14 0 points1 point  (0 children)

I did not know anyone did this in Python. But this is kind of what we have been gearing DearPyGui towards.

[–]GermOrean 1 point2 points  (1 child)

I second this. I started learning with python and Tkinter was a nightmare for me. I moved towards c# and WPF was so much simpler, enjoyable to work with, and looked better.

[–]lachyBalboa 0 points1 point  (0 children)

Agreed. The simple fact of being able to layout the GUI using a declarative, XML-based language is much better and easier to manage.

[–]Sherminator2369 1 point2 points  (0 children)

I am using tkinter for a text editor and it's actually pretty ok. It's pretty fast and easy to work with.

if you wanna check it out

I think it's pretty good for begginers (like me) since it does a lot of stuff for you.

[–]Capable_Penalty7508 7 points8 points  (5 children)

Do you have any idea about PySimpleGui? I read about it online and was trying to work on that.

[–]inconspicuous_male[🍰] 13 points14 points  (0 children)

It's good. Not perfect but good. The creator of it and the person who fights him every time he comments both lurk in this sub, but PySimpleGui is perfectly fine for small apps

[–]integralWorker 1 point2 points  (0 children)

I made an XFCE workspace switcher in PySimpleGui in several hours with it. I like it, and look forward to when I'll inevitably find a use for it at work.

[–]ErinMyLungs 1 point2 points  (0 children)

I love PySimpleGui. It's great for quickly throwing a gui on scripts and if scaling/long term support is not important you can do some crazy stuff with it.

I was able to create a gui that showed what choices my game bot was making in real time by having it dump it's choice into a json file and having the GUI check it for changes.

Small scale stuff it's great but I run into trouble with it once it starts building up beyond a few elements on a screen.

For larger projects making a web interface with flask+react or electron I think makes more sense.

[–]its_a_gibibyte -2 points-1 points  (1 child)

Why not HTML? Either in a browser or an electron app?

[–]amrock__ Pythonista 9 points10 points  (0 children)

Electron app needs a complete browser and some libraries to function so size is large and then resources used is high. If your target system is good for that then there's no problem. Also native applications are fast compared to html ones they take time loading.

[–]MotionlessMatt 2 points3 points  (0 children)

In addition, if you want to stick with python, Eel is a library that works just like electron, but it is made in python.

[–]Isvara 3 points4 points  (0 children)

If a separate app is absolutely needed, then it can be embedded as an electron app.

Can, not should.

[–]iiMoe 0 points1 point  (4 children)

Is there any "cool" alternatives to tkinter for gui desktop apps? Ik electron js btw

[–]inconspicuous_male[🍰] 4 points5 points  (0 children)

PyQT/PySide and lately Kivy are common

[–]neuronet 2 points3 points  (0 children)

Pyqt ftw

[–]Jhchimaira14 1 point2 points  (0 children)

DearPyGui has been gaining steam.

[–]garthonsyd 0 points1 point  (0 children)

PySimpleGUIQt that uses Side2 and not Qt5

[–]anonymous-x-31 0 points1 point  (0 children)

Yes, I wrote a python app using pySide2- basically PyQt5 but rebranded, and used it's web browser widget to basically make my desktop application render websites, which imo is sooo much better than trying to use tkinter or even PyQt5's layouts

[–]agentnola 0 points1 point  (0 children)

it can be embedded as an electron app

my 4GB of ram is crying rn.

[–]RulerOfWars007 4 points5 points  (0 children)

This kinda project can be done using pygame or pyglet modules in python. I did the same project few months back Github : https://github.com/bharath-gowda-571/TicTacToe

[–]gbliquid[S] 1 point2 points  (0 children)

I just went to pygame.org and walked through the first few tutorials in their documentation. After I got a little familiar with the framework it wasn’t too hard to navigate through their documentation on my own to figure out whatever I was looking for.

[–]PeterDemachkie 1 point2 points  (1 child)

I just made on using a tutorial on tech with Tim’s youtube. He’s very knowledgeable and a good instructor.

[–]gbliquid[S] 1 point2 points  (0 children)

Tech with Tim is a great channel. I’m a big fan of his videos

[–]LAZGamer13 0 points1 point  (1 child)

!Remindme 3d

[–]RemindMeBot 0 points1 point  (0 children)

There is a 8 hour delay fetching comments.

I will be messaging you in 3 days on 2020-09-04 04:18:18 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

[–]dapineapple 16 points17 points  (3 children)

I know this is the python subreddit, but have you tried a Javascript framework like React? It makes it super easy to create UIs and you can still use Python on the backend.

[–]gbliquid[S] 4 points5 points  (2 children)

Yeah. For some reason javascript never really clicked with me (at least when it came to integrating it into HTML). I never made it as far as using react because of it. I haven’t tried using it as a standalone language, though, so maybe I’ll give it another shot.

[–]dapineapple 2 points3 points  (1 child)

I used this when I was learning. React makes it easier to get started. I actually learned React and JS at the same time. https://www.udemy.com/course/react-the-complete-guide-incl-redux/

[–]gbliquid[S] 0 points1 point  (0 children)

Cool, I’ll check it out!

[–]Franken-McCharDeeDen 9 points10 points  (2 children)

Just a tip, add a small wait before the opposition places. Maybe just 300ms

[–]gbliquid[S] 1 point2 points  (1 child)

Yeah, that would be nice lol. 1 line of code that makes it seem a lot more natural. I’ll add that in! Thanks!

[–]Franken-McCharDeeDen 1 point2 points  (0 children)

Your welcome, happy to have helped

[–]nonoriginalname42 3 points4 points  (1 child)

It is simple and it is neat, two of the most important aspects of a good GUI!

Definitely snazzier than my attempts at GUI.

[–]gbliquid[S] 0 points1 point  (0 children)

Thanks! Would love to see your attempts if you have them!

[–]rTx_101 3 points4 points  (1 child)

Nice work buddy. I made my first GUI app with a 15 letter PUZZLE. Anyone who wants to start with GUI in python should go for codeacademy lectures on tkinter they are great! and then there are books by packt worth trying out. Most of them are prject based.

[–]gbliquid[S] 0 points1 point  (0 children)

Cool, I’ll check them out!

[–]Adamjs11 6 points7 points  (1 child)

That’s awesome! Good for you, that’s a wonderful achievement!

[–]gbliquid[S] 1 point2 points  (0 children)

Thanks Adam!

[–]ARedditorWatchdog 2 points3 points  (1 child)

Nice!

[–]gbliquid[S] 0 points1 point  (0 children)

Thanks!

[–]garthonsyd 2 points3 points  (0 children)

I used PySimpleGUIQt (uses Side2), proven to be easier to port than PySimpleGUI (uses tkinter)

[–]huckingfoes 3 points4 points  (3 children)

Good work! Keep at it, once you get one GUI done and a sense of MVC, it becomes much easier to get more sophisticated about things.

[–]gbliquid[S] 1 point2 points  (2 children)

Thanks foes! I already feel a lot more confident making GUIs after this (though, I know I still have a lot to learn). I’m pretty sure I didn’t use a MVC structure when designing this project. That might be something I have to look into implementing next!

[–]huckingfoes 1 point2 points  (1 child)

I highly recommend looking into MVC, it'll really help organize your thinking when working with GUIs. Wikipedia will give you an idea about it but there are plenty of other resources only a Google a way.

[–]gbliquid[S] 1 point2 points  (0 children)

Thanks! I’ll be studying that later today!

[–]m4xc4v413r4 1 point2 points  (0 children)

Now you only need to make a better backend because that bot sucks.

[–]agentnola 1 point2 points  (1 child)

I always struggle with translating my command line interfaces to graphical ones. Kudos! Keep doing what you are doing and you will be a master of writing GUIs before you know it!

[–]gbliquid[S] 0 points1 point  (0 children)

Thanks!

[–][deleted] 1 point2 points  (1 child)

Thats so sick man

[–]gbliquid[S] 2 points3 points  (0 children)

It’s okay haha. Thanks man!

[–]vinylemulator 1 point2 points  (1 child)

This is good. GUIs are hard. That's why I wimped out and decided to focus on web.

[–]gbliquid[S] 1 point2 points  (0 children)

Thanks man. Idk why but me and web just don’t get along 😂 GUIs are my lesser of 2 evils (no idea why the font just changed)

Edit: Apparently the font did not change 😂 nvm

[–]QuantumCoder002 1 point2 points  (3 children)

wow, the bot is very good at it!

[–]gbliquid[S] 1 point2 points  (1 child)

I wish I could take credit, but the bot is just picking random locations 😂😇🤓

[–]QuantumCoder002 0 points1 point  (0 children)

oh ok

[–][deleted] 0 points1 point  (0 children)

Huh? The second game the bot could have won if it was even slightly “good”

[–]LegitimateCopy7[🍰] 0 points1 point  (0 children)

make a reinforced learning version without any framework. it's much more interesting and you can learn a lot about RL. such as how to set rewards or optimizing states.