I've been searching the web and reading about GUI development in Python and have read that Tkinter is one of the best GUI toolkits for Python. But I also know that Pygame is a library that can be used for GUI. As i'm fairly new to programming, could somebody please explain the differences between Pygame and Tkinter, and which should be used in what occasion. Which would be a better choice for a chess engine GUI. Thank you very much in advance.
PYGAME and TKINTER in HARMONY. Despite what is said on some forums, Tkinter, the middle weight python GUI, works quite well in conjunction with pygame, the python SDL layer - at least when pygame is not in full screen mode. Pygame has been used as the graphics/media engine for many serious application (eg.
Pygame GUI is a module to help you make graphical user interfaces for games written in pygame. The module is firmly forward looking and is designed to work on Pygame 2 and Python 3.
Anyhow, in most situations, the best solution is using PyQt, considering the advantages and disadvantages of both PyQt and Tkinter. GUI programming with Qt is created around signals and slots for communication amongst objects.
Pygame is not commonly used commercially.
First, tkinter is definitely not the best GUI toolkit for python. It's one of the simplest and usually comes with the python interpreter. But it's not as powerful as Qt, wx or Gtk.
pygame is - as it's name states - a package designed to allow to create games in python very easily, not to create GUIs. As such it provides event handling, graphics sound bindings and some other things useful to write games, and it's written on top of SDL.
So if you want to write a GUI-application, don't use pygame.
On the other hand GUI toolkits can also be used to write games. Generally I would say they are much more versatile then something like pygame, but they're not really comparable. It all depends on the application you want to write. The choice of the right tool is usually something very important.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With