Closed icarpio closed 4 years ago
Games that are one file work 100% but those that are in several files (... main.py) give me an error, any advice?
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\pgzrun.exe__main.py", line 9, in
Hi, this issue is fixed in the master
branch on GitHub.
If you want a workaround for Pygame Zero 1.2, add from pgzero.builtins import *
to the top of any .Py files you want to use except for the main one.
storage
is a new feature in development and requires the GitHub version of Pygame Zero.
Hi lordmauve, Thank you for giving us Pygame Zero.
Let me ask you a questoion. You said at above timeline
If you want a workaround for Pygame Zero 1.2, add from pgzero.builtins import * to the top of any .Py files you want to use except for the main one.
As an example, does that mean like below in the first 3 line of flappybird.py?
from pgzero.builtins import *
import pgzrun
import random
But I still get a same error as
NameError: name 'storage' is not defined
Storage is new in the master
branch and you are using version 1.2.
For examples compatible with version 1.2, see the 1.2 branch, here: https://github.com/lordmauve/pgzero/tree/1.2release/examples
Thank you for the information. I will try the latest version.
pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\ProgramData\Anaconda3\Scripts\pgzrun.exe__main.py", line 9, in
File "c:\programdata\anaconda3\lib\site-packages\pgzero\runner.py", line 92, in main
exec(code, mod. dict__)
File "main.py", line 8, in
from actors import Player, Asteroid
File "C:\Users\Documents\Python Scripts\OpenCV\OpenCV\pgzero-master\examples\asteroids\actors.py", line 8, in
class Player(Actor):
NameError: name 'Actor' is not defined