Skip to content Skip to sidebar Skip to footer

Where Is The Button Widget In Pyglet ?

i'm checking out pyglet, but, funny enough, i can't find how to do a simple button! so what is the standard way to create a standard button? is there a standard way to create a Me

Solution 1:

I didn't use Pyglet yet, but is not a GUI library, it doesn't have to have widgets like buttons, or containers etc. It's a multimedia library like Pygame, it draws stuff on screen, plays sounds, and has some helper functions.

If you want to draw a button on screen, you should first draw a rectangle, print some text in it, and then listen mouse clicks to know if it's clicked on this rectangle.

See PyQT, PyGTK, WxPython for some examples of GUI libraries.

Solution 2:

You can see an example of how to create a button and create yet another interface with Pyglet in the script:

http://www.pyglet.org/doc/programming_guide/media_player.py

But this is only an example interface created without complex items.

Solution 3:

Current state of affairs 3 years later...

As previously stated Pyglet itself generally provides a lower level api than the UI widget library (e.g. closer to GDI or SDL).

That said there are gui's built on top of pyglet: https://github.com/jorgecarleitao/pyglet-guihttps://code.google.com/p/kytten/

Also pyglet 1.2 now has buttons itself (though not much else as far as widgets are concerned).

Post a Comment for "Where Is The Button Widget In Pyglet ?"