Adding wxPython GUI elements in a pygame physics s

2019-07-02 02:58发布

I have made a pygame physics simulation--'a projectile motion' but it lacks interactivity like accepting angle of launch,speed etc. I am wanting to add input boxes with increase decrease arrows but don't know how to go about it. Thanks for the help.

3条回答
贼婆χ
2楼-- · 2019-07-02 03:16

Maybe you can try PGU (Phil's pyGame Utilities).

In addition to other tools, it has a library for creating GUIs.
This PGU demo shows probably something similar to that you are looking for:

enter image description here

查看更多
何必那么认真
3楼-- · 2019-07-02 03:18

I don't think trying to add wx-Elements is a very pygame way of implementing a GUI, a better (in sense of portable) way would be to use some all-in-python-GUI-extention for pygame. But the issue of GUI in pygame is anoying, since I could not find any library that offeres such a thing.

I know of two interesting approches, first there is Albow (a little bit of widgetry for pygame), which has a nice implementation of styles. The newest Version (which is not very new, I'm afraid) can be found at http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/

Then there is OcempGUI http://ocemp.sourceforge.net/gui.html -- which has documentation and an some good concepts of event handling.

The sad thing is, both projects seem to be dead. I know of no other pygame-GUI that is worth looking at (correct my on that one, please!). For my own project I started to build something inspired by both of them (just don't expect that to ever become useable), since I'm not really content with either of the two. But they might by just the thing if you don't want to put too much time into it and want to have a good collection of GUI elements from labels and buttons up to file browsing dialogs or scrollable text fields.

查看更多
登录 后发表回答