Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What gui toolkit should I use with Pygame? [closed]

I'm making a game that needs to be able to pop up gui elements within a pygame surface. This question isn't what I want because wxPython goes around the SDL surface, not inside it. So far I've only seen ocemp, pgu, and GooeyPy in this problem space.

  • Ocemp is huge and crufty looking. It mentions Python 2.3 and the newest file I found in a quick browse of the cvs repo was 2 years old.
  • I couldn't get GooeyPy to work (though I didn't try very hard; eggs and Debian are not friends) and v0.2 was last updated in February of 2009.
  • I've been working with pgu, but it appears to be unmaintained (last update 11/2009 and original maintainer abandoned it) and it's starting to show its age. It uses old style classes and throws string exceptions.

So my question to you, SO, is this: What gui toolkit should I use for making pretty clickable buttons pop up in your pygame applications? Are there any in active development?

Edit, September 2011

It looks like PGU is still being maintained. The last commits are from 4 days ago.

like image 751
nmichaels Avatar asked Jul 27 '10 11:07

nmichaels


People also ask

Can you use tkinter and pygame together?

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.

Should I use tkinter or pygame?

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.

Can you make a GUI with pygame?

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.

What does pygame quit () do?

quit() is a function that closes pygame (python still running) While pygame. QUIT just checks if pygame is running or not. I put pygame. quit() function after the while loop to make sure that pygame is not running after the while loop.


1 Answers

I'm not aware of any pygame gui stuff, but it shouldn't be terribly hard to roll your own (and hey, maybe make it open source!)

If you're just doing a few simple buttons you could use GIMP or Photoshop or something else to make two (or three) images - an up, down and possible hover button, then you'd write your own event loop/handler that would do something like this:

  1. Get the mouse position
  2. Is the mouse over any of the buttons (and no buttons are pressed)?
  3. Display hover image
  4. Is the mouse over a button and a mouse button is clicked?
  5. Fire event associated with that button
  6. See 1

That's a bit simplified, but it should at least give you a starting point (if no one else has any pygame GUI libraries)

like image 164
Wayne Werner Avatar answered Sep 22 '22 10:09

Wayne Werner