Jan-22-2019, 06:37 AM
I tried installing python 3 and am happy to report that, contrary to what you might read elsewhere, this installation does not change the python command to use python 3. This also allowed me to install pygame easily in a virtualenv with a simple
So I broke down and installed homebrew and installed a long list of stuff per this link. My approach was to try and make sure I got the major libraries installed then try the pip install again. This may not be a complete list of brew commands but it appears to have resolved any errors:
My game script is so far very short. Just this:
pip install pygame
but did not solve my problem because apparently livewires is not compatible with python 3.So I broke down and installed homebrew and installed a long list of stuff per this link. My approach was to try and make sure I got the major libraries installed then try the pip install again. This may not be a complete list of brew commands but it appears to have resolved any errors:
Output:# install home-brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew install caskroom/cask/brew-cask
brew cask install xquartz
brew linkapps python
brew install sdl sdl_image sdl_ttf portmidi libogg libvorbis
brew install sdl_mixer --with-libvorbis
brew tap homebrew/headonly
brew install smpeg
brew install mercurial
I then ran pip install pygame
and it appears to have run to completion. I was able to run python -m pygame.tests
and it skips a few but otherwise reports OK:Output:Ran 715 tests in 19.033s
OK
My short program now runs without any errors at all and the stdout reports pygame:Output:pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
However, it just shows a window without the background image. I’ve checked, double-checked, triple-checked that the image exists, is valid, and the path is correct. I’ve tried an absolute path. It just won’t show the jpeg.My game script is so far very short. Just this:
from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) wall_image = games.load_image("/Users/yamo/trash/python/ch11/wall.jpg", transparent = False) games.screen.background = wall_image games.screen.mainloop()If anyone can help me get this working, I’d be most grateful.