views:

165

answers:

2

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?

+1  A: 

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)

Wayne Werner
This is what I was trying to avoid. I'd rather take an existing library like pgu (which is LGPL licenced) and update it. It's 40 source files (not counting documentation) and about 7,000 lines of Python code.
Nathon
That's also possible - I've never used pgu so I have no clue how advanced it is - but if it already does a lot of the initial work, you have every reason to go ahead and update that. Assuming those 7,000 lines are good lines, anyway ;)
Wayne Werner
Yeah, I'm thinking I may just do that, assuming StackOverflow doesn't add any magic data to the equation.
Nathon
A: 

Given that nobody's come up with any alternatives, I'm going with PGU and updating it as I go. I'm just writing this as an update for future pygame/gui seekers. If things work out, I'll submit my updates to pgu's current maintainer.

Nathon
Same boat. So how's it going?
Trey Stout
@Trey, It's working pretty well. I've been distracted from this project by other stuff lately, but once I got past the old style classes and some of the wonky stuff in pgu it became very usable.
Nathon
That's good news. Any code worth sharing yet? :)
Trey Stout
Sadly, no. Maybe this month I'll have some time.
Nathon