Python game design without Pygame - python

This topic is in response to a problem I've been having getting Pygame to be set up correctly on my computer. I have Windows 7, Python 3.3 and "64-bit" Windows (now I know what a bit and a byte are, but I don't really understand the implications of having a "64-bit" computer) I'm proficient in Python but know nothing about binaries, dependencies, registries or other such internal/system-level structures; not that I'm not interested, but at the moment most of what goes on is essentially "over my head".
But anyway, with that said, the problem I've been experiencing is basically that I can't install pygame. I've been over several versions of the same question (on Stack Overflow and other places on the web), and I've attempted to install pygame countless times. Sometimes it seems to work fine until I attempt to use it (the installation appears to have been successful but Python gives me errors when I try to use pygame), or I get something about Python 3.3 not being in my "registry" (which from what I read appears to be another OS-level/internal structure for those who understand "the base code of the universe"). They could actually develop a series of tutorials on just the installation process. :)
But all joking aside, I am at a loss here and considering just giving up on pygame. So my question would be, is there any way to use what's already installed (Python's libraries etc.) to develop games? If not, do you know of any alternatives that don't require the same level of experience to install? I've Googled around but everything I've found about game design in Python leads back to pygame. Thanks in advance.

To save yourself pain, just use 32bit python, and 32bit pygame. If you mix 32 and 64 bit, it will not run correctly. That's probably the problem you're having.
Since you have python 3.3, you would use https://bitbucket.org/pygame/pygame/downloads/pygame-1.9.2a0.win32-py3.3.msi
You shouldn't have to edit the registry or your environmentvariables unless something goes wrong.

As mentioned previously, tkinter would offer a solution. For example, this was created in tkinter (http://www.youtube.com/watch?v=RHxLkNryOzI)

The pygame downloads page hasn't been updated for a while and is incompatible with python 3.x. Newer versions of pygame can be downloaded here.
I'd personally use pygame as there's audio support as well but tkinter could be used.

Related

VS Code is unable to locate python

I have been looking at similar problems and everyone has a promising solution which usually revolves around changing the interpreter path. I have done my best but have run out of solutions that I can think of. I'm hoping someone else knows how and thank you for any comments.
No version of python ever appears, I have tried to enter the path in the box at the top but have had no luck
I want to switch from 3.10 to 3.9 and this is when not being able to select the version of python became a problem. The picture above is from the terminal within VS Code
This is the default path I have entered in VS Code
The photo above is from the Windows command prompt, locating the active version of python
I would like to be able to use Python 3.10 in some folders and 3.9 in others, however at the moment I really just need VS Code to see 3.9, I imagine once I know what has gone wrong at this stage it will be smooth sailing from here.
I have already uninstalled and reinstalled pretty much anything I can think could be related
I really hope I have just made a stupid mistake somewhere and it is really obvious, thank you again

PyGame slower on macOS than on Ubuntu or Raspbian

I use PyGame for creating games, but I noticed that the programs ran a lot slower on macOS than on my Raspberry Pi. My original solution was to install Ubuntu alongside macOS on my computer, and that worked. However, I would rather only have one operating system on my computer. Does anyone know why PyGame is so much slower on my mac when running macOS?
If it would help, I can send code. However, I have multiple PyGame programs and they all do the exact same thing, so I figured that it was most likely not the fault of the code, but I could be wrong.
Any help is appreciated, thanks.
P.S. When I say slower, I mean that it is running at about 30% of the speed on macOS than it would on Ubuntu.
Pygame is based on the SDL library. It supports using various rendering backends, such as OpenGL and metal. According to this answer (and the comment), it seems that the metal renderer might perform poorly on mac. Sadly, according to this issue, it seems that in most versions of pygame, it uses metal as the SDL backend for mac, and provides no way to change that.
There is the pygame.OPENGL flag you could pass to pygame.display.set_mode(), but I'm not sure exactly how it would affect anything. It might be a good idea to play with the other flags listed here.
I'd recommend you to open an issue on pygame's official github repo with the necessary details. Also, as a workaround, you could clone pygame, change the default renderer on mac to OpenGL, compile, and see if it improves anything. You can use the issue I mentioned above to understand where you should start.
Try running your game in full screen mode
pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
MacOS is generally slower
Unless you can install a second RAM stick it will always be that way

Kivy installation python 2.7 windows 10

I want to develop python 2.7 app using Kivy library on Windows 10, but I do not know how to install it. I have tried to install Cython,Pygame and then Kivy.But it did not work. I have reinstalled all these things like Cython,Kivy,Python... And now I want to install it from the beginning. How can I install Kivy?
Your answers will be very appreciated.
Kivy changed a little bit since 1.8.0, use the new instructions if you have pdf docs, or some kind of book. So... the default provider is sdl2 now(pygame isn't necessary). Also, there's no need for compiling since there are wheels, so even cython and mingw aren't necessary(if you don't code with them). The only thing you need is python installed correctly.
At first of all you should visit main page and especially documentation where is described quite well what is needed and what you should install, yet still someone comes with missing dlls or something, therefore read it carefully. Or grab a tool.
But really, use the docs, most of the stuff is documented either in docs or here(examples, problems,...). No one's going to read it for you. :)

Want to rework Python and add-ons for Mac OS X 10.7

I have been trying to graph with python for some time now. I want to use matplotlib, but have hit so many bumps in the road. Previously, numpy and matplotlib have been installed, but I am stuck with this error: ImportError: numpy.core.multiarray failed to import. I'm running Lion on Mac. I think I'm using Python 2.7. I have also tried full walkthroughs, such as this as well: http://penandpants.com/2012/02/24/install-python/. After several installation methods like pip and homebrew I am afraid that there's a lot of knotted things going on with python on my computer. And I really don't know how to untangle it.
I am reasonably knowledgeable with programming and algorithms, but I lack the know-how on how all the add-ons such as matplotlib that connect with python or how a text editor that can execute my code like Sublime Text 2 accesses them. So, as much as I would like to aid this asking-a-question process by letting you know what versions I am using, I don't really know how. Any guidance to how python connects to these things would be really appreciated :)
Ultimately, I wish to start from scratch with this whole mess, reinstalling python and then matplotlib from the ground up--but I'm not totally sure how. So, I guess my final question is how do I do that, or if that is just a wrong line of thinking how do I proceed if I want to graph some mathy things with python?
Sorry for the long winded question, I'll appreciate any help even a nudge in the right direction in learning how my computer organizes python on my computer!
Thanks!
I've had similar problems and the best solution I found was to use MacPorts for managing python and my installed modules. The things that I particularly like about using MacPorts for this are:
You can easily install multiple python versions (with modules separately installed for each installation)
You can select which python installation is the default (whether it is one installed by MacPorts or your OS X python installation).
Many MacPorts packages have optional variants so you can easily customize how they are installed (e.g., should numpy use the ATLAS library from MacPorts or from OS X) .
If you screw up your installation, you can easily wipe MacPorts from your system without worrying about breaking anything (almost everything installed by MacPorts is put under /opt).

Playing MP3 files with Python

I'm trying to write my own media player (like Foobar), and I'm having trouble tracking down a Python library that'll play MP3s. I know Pymedia does mp3s, but it looks outdated - the latest installer is for Python version 2.4, and I'm using 2.6. I've never had much success with Pygame, and Pyglet doesn't look like it has too much in the way of documentation. Are there any other alternatives?
There is http://pyglet.org/ and also have you tried http://code.google.com/p/mp3play/? It's also available from PyPi (http://pypi.python.org/pypi/mp3play/) However, I think mp3play is Win32 only for now.
Looking at the updates, there were commits within last couple of months.
I've been using PyMedia in Python 2.6.5 on Windows successfully. Caveats: the documentation is bad and wrong -- many of the tutorials have glaring errors or otherwise don't work -- so I had to do some experimentation and Googling to get my code to work right. Also for whatever reason the maintainers seem to have stopped updating the project site 4 years ago, though they seem to be actively doing something.
I found installers here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
The semi-active forum linked from their website includes some code maintainers who are semi-helpful. I'm jboyd99 if anyone is looking for tips.
For reasons that are beyond me the focus is on car audio systems, despite the fact that it is a fairly fully featured library that does some things no other free Python library does, like read MP3s into raw PCM data. The library has some flaws -- I'll probably use PyAudio or PyAudiere for actual playback for better control of synchrony issues.
Maybe it'd be simpler to write that part of your application in Python 2.4 as a separate "backend". This way you could use PyMedia (http://pymedia.org/) (as you mentioned) for the actual playback. It'd allow you to write your GUI in another Python version (like 2.6), which would also mean more decoupling of program components and parallelism (smoother GUI).
If you target only the Windows platform, then using Media Player via COM might help:
http://www.daniweb.com/code/snippet216465.html

Categories

Resources