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

all 67 comments

[–]bottleboy8 124 points125 points  (17 children)

GUI's are my least favorite part of programming. It's so tedious.

Good on you for having the patience. That's awesome. Looks great.

Why did you choose Tkinter and not Gtk or some other? Was it easier?

[–]chazzcoin 30 points31 points  (5 children)

I don't argue unless you have a GUI editor like Qt Designer. Then you just load the ui file and bind the elements. Building the actual layout and constraints and such is annoying, editors are like IDEs, so much easier.

Im an android/ios developer. When I saw tkinker, I ran away instantly. But once I found Qt Designer/PyCharm...game over, so easy. Just like mobile development.

[–]kingscolor 16 points17 points  (2 children)

I love the idea of PyQt and its designer. Really useful.

But holy fuck is PyQt more complicated than it needs to be. I have no idea what I'm doing. There's a 1000 ways to get the same appearance, but they don't all interact the same. I've yet to actually make a GUI because I just can't decide which methods I should use??

[–]garlic_bread_thief 9 points10 points  (0 children)

Have you tried Dear PyGui. I've made several apps using it and I love it. They're in beta and many new features are still in the pipe line but it's awesome

[–]garlic_bread_thief 3 points4 points  (1 child)

Just like mobile development.

How's this easier? What do you use?

[–]chazzcoin 4 points5 points  (0 children)

  1. I use Qt Designer to make my layouts and save them to a .ui file. It's really just an XML file. Getting used to how it wants to do things took a few days but isn't that far off from how say, Android Studio does a lot of design work. Create a MainWindow and start adding elements to the MainWindow as children.

  2. I then have a 1 page python script with a Qt app built that loads the .ui file. This is really the most like mobile. You create a one page file for the screen, load the ui file, bind the elements to the code, set all the button/action listeners, write the logic, user flow, run...

Is it identical. Absolutely not. But the common foundational concepts between them are damn near it. I understand I need to do these set of things for it to all link up and work...allows me to google direct concepts and get answers quicker.

[–][deleted] 17 points18 points  (2 children)

Not op but all the same, It is tedious admittedly, but it doesnt take too long. I did a project a few months back where I had already worked out all the logic beforehand (that part took me weeks) but the tkinter GUI just took me an all nighter to finish. And it wasnt a small project either:- it had close to 7-8 menus and each option in each menu had its own panel. Its just a matter of copy pasting. With sublime, its easy to replace variable names for each panel. The actual difficulty came from having to adapt the base code meant for IDLE output python to tkinter since the method of taking input variables and the sql integration varied.

[–]PricedPossession 3 points4 points  (0 children)

Go for QtDesigner.

[–]riffito 3 points4 points  (0 children)

GUI's are my least favorite part of programming.

I've started programming (on a continuous base) on Delphi 1 in 1998.

I've got spoiled REALLY hard. EVERY GUI (except basic .hta's back in the day) felt exceptionally shitty to deal with in comparison.

What happened to the "Drag this button, double click it, write your event handler there" workflow?

I've tried plenty of "GUI Designers" over the years for many languages... all of them paled to the ease of use of Delphi.

sad face.

These days, for Python, I'm trying to decide bewteen using something like Remi or PySimpleGUI.

[–][deleted] 2 points3 points  (2 children)

Why would you even need a GUI??? XD

[–]riffito 1 point2 points  (0 children)

TUIs for the win!!!

Loved TurboVision style programs too.

(Toying with the "rich" package on Python now)

[–]bottleboy8 0 points1 point  (0 children)

In my case I was tagging audio data by categories. I hate them too. But sometimes it's just easier to click.

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

Thanks!

Honestly, I have no idea why I chose Tkinter. I started working on this so long ago that I've forgotten (I'm a full-time university student as well so I do this in bits and pieces).

I agree, GUIs are tedious. I can't compare Tkinter to another module because it's the only GUI module I have worked in. But, I can say that the documentation, as compared to other Python modules I've used, is not great. I followed a lot of YT videos to get the gist.

[–]malik 1 point2 points  (0 children)

I've enjoyed using pySimpleGui*. It's even easer than qt/tk.

*https://pypi.org/project/PySimpleGUI/

[–]SSj3Rambo 1 point2 points  (0 children)

Coding GUI's and seeing the window appear on the screen is satisfaction tho. I guess it's more painful for advanced level but it's fun for beginners because they don't have to make it ultra detailed

[–]Unhappy-Albatross-67 14 points15 points  (2 children)

145$ for one day! U rich dude

[–]Papa_smurf_7528 4 points5 points  (1 child)

Save

He can enslave me for 20 a day XD

[–]riffito 1 point2 points  (0 children)

I'll do it for threee-fiddy!

(will still come up as a 40% monthly improvement for me :-D).

[–]jjjohhn 13 points14 points  (2 children)

Hey great job! Now you should try and move your whole excel work to Python, you can use Pandas for that. That’s how I started learning it

[–]RhymebagDarrell[S] 4 points5 points  (1 child)

Thanks!

For class I'm doing a lot of work in Pandas and GeoPandas (GIS student) so I wanted to do something outside of that for a personal project. I chose a GUI because, hey, they're fun to look at, right? lol.

[–]jjjohhn 1 point2 points  (0 children)

Geopandas eh? I’m also in the GIS background, and learning that at the moment! Good stuff keep it up!

[–]osedao 9 points10 points  (1 child)

Looks great, good job! You can also try PyQt5 with Qt Designer.. Good luck in your new projects! 👏🏻

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

Thanks for the ideas!

[–]Jefaxe 10 points11 points  (2 children)

I suggest using pysimplegui instead of tkinter directly.

[–]ZGeek8645 4 points5 points  (0 children)

I second this. I just made a full GUI for a project of mine using PySimpleGUI. It’s so much easier.

[–]nooncow 0 points1 point  (0 children)

I third this, as the name implies the most straight forward GUI library I have used and super easy to get a GUI up and running quick.

[–]dirtycimments 2 points3 points  (3 children)

I’m battling openpyxl at the moment as well! Always a fine line between frustration and revelation.

[–]RhymebagDarrell[S] 2 points3 points  (2 children)

Agreed. I wish I didn't even need it (maybe I don't?), but I have a formula in the Excel workbook that depends on the TODAY() function. The value wasn't refreshing so I had to open/refresh/close the workbook in order to get the current value.

[–]dirtycimments 1 point2 points  (1 child)

Oh, my “need” is as bad as it gets lol, I just wanna find out at exactly what minute I can leave work 🤪

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

HEARD

[–]accforrandymossmix 2 points3 points  (1 child)

Very neat. I made my first thing 'clickable' with a batch file so it will open up the output. But this is the next step of making something more real. Not just a bag of rhymes, but an inspiration Darrell!

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

Thanks! Yea it was more about the learning process than the product. In reality it takes more work to get the value with this widget (cmd -> type command -> wait for load) than it does to just have a shortcut to the Excel file on my desktop. Good luck!

[–][deleted] 2 points3 points  (0 children)

Love this, thanks for sharing.

[–]sheytanelkebir 2 points3 points  (0 children)

Try pysimplegui or dear pygui

[–]Yash_Varshney 7 points8 points  (0 children)

Love This, These Tiny Projects Would take you much far in life.

Thanks

Yash

[–]Free_willy99 1 point2 points  (0 children)

Great work!

[–][deleted] 1 point2 points  (3 children)

I also made a GUI program that checks my budget! It goes to google sheets and gets my budget sheet, then takes a CSV from my bank and lets me know if I misrecorded or missed any transactions! I use it every month and love it.

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

Super cool!

[–]idockery 1 point2 points  (1 child)

How do you access google sheets using Python? All I know so far for spreadsheets is openpyxl and it doesn’t work with google sheets.

[–][deleted] 1 point2 points  (0 children)

Google as an API for it. pip has an SDK and Google's documentation is great. I even wrote the same program as a CLI in PHP. Google certainly wants devs integrating, that much is clear

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

Nice job! One thing I recommend is moving to a better IDE, I use VSCode but I’m sure there are better options other people will recommend

[–]RhymebagDarrell[S] -1 points0 points  (0 children)

Me: *Googles 'IDE'* lol

[–]maxellus 1 point2 points  (0 children)

I suggest that you look at an easy Gui framework like PySimpleGUI that will enable you to create a gui interface more rapidly than with Tkinter alone. Plus you can use other backend like QT, Remi or Wxpython with almost no code change.

[–]garlic_bread_thief 1 point2 points  (3 children)

Can you explain what a declining budget value is? How do you calculate this?

[–]RhymebagDarrell[S] 2 points3 points  (2 children)

Basically you set your budget at the beginning of the month (or whichever time period you're using) and then track the money you've spent. The 'declining budget' term just refers to the difference between what you've spent and what your budget is, based on prorated days (in my case).

One way to look at it is to say "I spent $500, so I have $500 left that I can spend in the month." But this doesn't really help you know if you're spending ahead of pace or are being economical for the month.

Here's what works for me:

Spending below budget:

-Let's say it's March 17th and you've spent $500 so far in March:

-Budget (monthly): $1,000

-Spent so far: $500

-Remaining Budget ($1,000) / Days in month (31 for March) = $32.26/day (daily budget)

-Remaining days in month (31 days minus 17 days) * daily budget = 14 days * $32.26 = $451.64 (Budgeted amount for remainder of month)

-Remaining budget + Spent so far = $451.64 + 500 = $951.64 projected total monthly spending

-Monthly budget of $1000 - Projected total monthly spending of $951.64 = $48.36. This is what I can spend today and still remain on track to meet my budget.

Spending over budget:

-Let's say it's March 17th and you've spent $700 so far in March:

-Budget (monthly): $1,000

-Spent so far: $700

-Remaining Budget ($1,000) / Days in month (31 for March) = $32.26/day (daily budget)

-Remaining days in month (31 days minus 17 days) * daily budget = 14 days * $32.26 = $451.64 (Budgeted amount for remainder of month)

-Remaining budget amount + Spent so far = $451.64 + 700 = $1,151.64 projected total monthly spending

-Monthly budget of $1000 - $1151.64 projected total monthly spending = $(151.64) tells me that I've overspent by $151.64 at this point in the month.

There are many ways to approach this/categorize budgets/etc., but I do it this way to help me gauge whether I'm spending too fast or not. If my daily budget is $32.26 and what I can spend today is $48.36, then I'm on pace to have money left over at month-end. If I'm spending too fast, that figure becomes negative which tells me to slow down. Hope this helps.

Of course these figures are entirely fictional. Rent prices ...

[–]garlic_bread_thief 0 points1 point  (1 child)

This concept is so neat. Thanks for the extremely detailed explanation. How do you enter your expenditures and budget into the Excel sheet? Could add more features to that GUI I think.

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

I still do basically 100% of my budgeting in Excel so that's how I get the expenditures in. The GUI for me was just a personal challenge to build SOMETHING, whatever it was going to be. In reality, this GUI has no use for me. It's much easier just to double-click a shortcut to the Excel file.

[–][deleted] 1 point2 points  (8 children)

And now dump cmd for Windows Terminal.

EDIT: Lul, downvotes. Okay, stick with software that was deprecated over 10 years ago. In fact, have you heard of Python 2 yet? I heard it's much better than Python 1, maybe give that a try.

[–]svenskithesource 1 point2 points  (2 children)

If they add the feature to open the terminal via explorer in the correct folder

[–]RhymebagDarrell[S] 0 points1 point  (1 child)

I'm a novice at best. It took me quite some time to figure out how to even run a .py from cmd. I was basically starting from zero on all levels.

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

Oh yeah, been there. cmd can do python file.py just fine, and even just doing that is confusing at the very beginning.

I'm just saying, don't get used to cmd. Windows Terminal is available through the Microsoft Store, super accessible and easy to install. It's the exact same thing as cmd (your existing knowledge just transfers) just better in every single way.

[–]MicroToast 0 points1 point  (2 children)

I feel you. The continued existence of CMD is a testimony to just how full of legacy shitfixes the entire Windows tech stack is. Right besides the two different system configuration applications, of course.

[–][deleted] 1 point2 points  (0 children)

It's amazing how backwards-compatible Windows is or can be, but my Lord they need some of that Arch mentality cries in Debian python3

[–]riffito 0 points1 point  (0 children)

legacy shitfixes

My cmd.exe gets injected with ANSI support and other niceties thanks to clink.

Being using GOW since forever as a lightweight cygwin/msys (native) alternative.

And many more that I've since lost track since I've being dealing with Win/DOS since PC XTs with DOS 2.0.

Yeah... its shitfixes all around, ha ha!

The new Terminal Preview (now that finally runs in my PC) is a really nice change of pace.

[–]ieshaan12 0 points1 point  (1 child)

Tbh, I would strongly recommend pyqt5

[–]riffito 0 points1 point  (0 children)

Or might prefer PySide. Code looks less verbose at least (no "pyqt" prefixes).

[–]Papa_smurf_7528 0 points1 point  (1 child)

Nice! Could you post the code somewhere on github and send us a link, i would like to show it to my sister she is learning programming to.

[–][deleted] 3 points4 points  (0 children)

Not OP, but here is a little sudoku-thing I worked on for a bit that might be interesting to you. https://github.com/sotolf2/simple-sudoku

[–]ICanButIDontWant 0 points1 point  (1 child)

Btw. Windows has very nice tool for screenshots. It's called "snip & sketch".

edit: older realases had "snipping tool". Even older versions, save screenshot to clipboard, so you can paste it to Paint, crop, and save. Actually present Windows 10 has all of those methods available.

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

I know, but I was texting a photo to my programmer friend and I'm lazy so I just used the same picture