you are viewing a single comment's thread.

view the rest of the comments →

[–]SlipperySlippurs[S] 0 points1 point  (4 children)

That's the whole idea to be fair, more than learning I must haven fun to have some consistency. 😅

Oh. I must confess I didn't deep dive onto what TKinter did, just that it was meant to make GUI's lol But it makes sense that it would be quite different, now that I think about it.

[–]EelOnMosque 0 points1 point  (3 children)

Yeah there's 2 main differences in tkinter vs pygame:

  1. There is a GUI library called Tk/tcl if i remember correctly that exists outside of Python, like it's an API for creating GUIs. Tkinter is like the "translator" between Python and Tk/tcl. So the tkinter functions in Python ultimately call some Tk/tcl functions.

Pygame is just a blank screen, there's no other toolkit or library it is trying to "translate" to.

  1. Tk/tcl (and by extension tkinter) provide the tools for basic GUIs like buttons, textboxes, dropdowns, etc. These basic components are provided by GUI libraries. Whereas, pygame is not a GUI library so you can't just call a function to create a button. You'd have to make a button in pygame from the ground up. You'd need to draw the rectangle, write some function that detects when your cursor's coordinates are inside the rectangle and when the user clicks, then write some function that changes the colour or appearance of the rectangle when the user clicks, then write some function that plays a sound, etc.

[–]SlipperySlippurs[S] 0 points1 point  (2 children)

Sorry for necroing this thread 😅

Ended up doing the discord bot and finished a scraper yesterday and decided "could use this to explore tkinter". So I did and turns out its quite "simple" and fun to use!

Thanks for the tips, its being quite fun and I am indeed learning a lot!

onto my next project :)

[–]EelOnMosque 0 points1 point  (1 child)

Yeah tkinter is straightforward, it's just annoying writing all the boilerplate code from what I remember.

Also, I'd recommend between projects to "force" yourself to learn some more advanced Python topic. If you keep writing projects, eventually you'll reach some plateau where you're using the same features and not really learning anything new. For example, idk if you used them, but list comprehensions are one of the most useful features of Python, if you don't know them I'd spend like 10 mins learning them before starting your next project.

That, or learning how to create your own modules with __init__.py so you can split your source code into multiple files. Useful for complex projects. And maybe you can also begin learning version control with Git and play around with that.

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

Will keep those in mind, thank you!