Adding wxPython GUI elements in a pygame physics simulation - python

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.

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:

Try Some of these:
http://wiki.wxpython.org/IntegratingPyGame
http://www.pygame.org/project-Pygame+embedded+in+wxPython-1580-2788.html
Good luck!

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.

Related

How to create a single-window GUI

What is the best way to accomplish a "Single-Window" GUI in PySide2 (or PyQt if that is more familiar), in the same vein as the old school installation wizards?
The two approaches I have thought of would be to:
Close the present window and create a new window in the same position and size of the last (though I suspect that would seem stutter-y).
OR:
Create a bunch of widgets and hide/show them as necessary. (Though, I am remembering days of learning Visual Basic and creating awful memory issues doing this).
Is there a better/best practice way of doing this?
Edit: Not really sure why this is getting down-voted. I am asking this question here as I did not see a definitive answer elsewhere. Or are general approach questions disallowed?

Is there a way I can use Python to control the size and position of a Mac Window?

Generally I want to write a program to run in the background on Mac and when I push a keyboard shortcut, the current active window would be resized and positioned to the way I have set.
Something similar to the tool called SizeUp on Mac. I think this shouldn't be difficult to implement and would be fun to take a try.
I would appreciate any resources you could point me to. Thanks.
I think you're going to have an easier time attacking this in applescript. Upon casual googling, this link seems to have more or less what you want. If you were more looking for a programming challenge in python, and less for a solution, then disregard this.

Character Control using Python

I was wondering if anyone knows how to import a sprite and let it move when pressing the arrow keys in python, without using pygame, or some other library. This is purely out of curiosity, because I was just thinking about some sort of personal challenge, and that's what came to mind: a python game, without the help of pygame or libtcod. Is this possible, or do you need a library to do this for you? I'd appreciate anyone's input on this one.
Thanks.
What comes to my mind is using Tkinter's Canvas class. It is quite possible to do a simple program like that described using bindings on this class.
A good example of this may be found in Mark Lutz's Programming Python (http://shop.oreilly.com/product/9780596158118.do), the Moving Pics example.
If you don't own this, you can still look at the code for it as a reference by downloading the code using the link on the right side of the page. The path to the appropriat folder is /PP4E-Examples-1.3.1/Examples/PP4E/Gui/MovingPics/.

GUI toolkit for creating fully customized UIs? If I were going for a completely non-os native look, which toolkit would you suggest?

I've been asked to build a gui for a friend. We're going for a fully custom look. All buttons, states, widgets, etc.. will be will be drawn by an artist. The only native widget I foresee needing is a listbox (because I'm not entirely sure how I would build one from scratch).
Additional requirements are mp3 playback support.
The list of available frameworks on python.org is pretty daunting! Could anyone suggest a good starting point?
I apologize for the open ended-ness of the question!
Build it with pygame would be my advice.
That will give you a pixel identical GUI on all platforms - ideal if you have an artist make everything for you.
You'll have to implement your own listbox, but pygame plays mp3s just fine.

Picking a suitable GUI framework for project

I have a project where I have to show some sort of changing bar graph with results from a function. This bar graph should be in colour and 3d. I want it to look good since it's an open source educational program where it teaches the user about different voting systems and how they effect the outcome of an election. I would like to use python but I have no idea about using GUI frameworks since all my work in python has been command line based. Your help will be appreciated.
For 3D graphics, you might want to use OpenGL with a game framework, such as PyGame or Pyglet. Use matplotlib as TJD suggested in the other answer.
As for GUI frameworks, they generally won't help much with 3D graphics:
PyQt is one choice; I see you already have it in the question tags. PySide is very similar to PyQt, but with a nicer licence.
Then there's tkinter (in the standard library), wxPython, and pyGTK – I hear all of them are good, though I don't know them personally.
Pick one and stay with it. It'll take some time to learn if you're not experienced, so don't expect results too soon.
You might want to look at matplotlib, which is probably the most widely used library for doing graphs, including 3-D.

Categories