Skip to content

Commit 2a17da8

Browse files
authored
Add --version argument to pgzrun (#355)
While developing on this project locally I wanted to check what version of pgzrun I was using. That wasn't implemented so I added it to the pgzrun runner. It looks like this now: ``` $ pgzrun --version pygame 2.6.1 (SDL 2.28.4, Python 3.13.2) Hello from the pygame community. https://www.pygame.org/contribute.html pgzrun 1.2.post5.dev202+gcd4f6dc.d20250413 ```
2 parents cd4f6dc + fc6e380 commit 2a17da8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/pgzero/runner.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from . import storage
22
from . import clock
33
from . import loaders
4+
from . import __version__
45
from .game import PGZeroGame, DISPLAY_FLAGS
56
from types import ModuleType
67
from argparse import ArgumentParser
@@ -68,6 +69,11 @@ def main():
6869
action='store_true',
6970
help="Print periodic FPS measurements on the terminal."
7071
)
72+
parser.add_argument(
73+
'--version',
74+
action='version',
75+
version=f'%(prog)s {__version__}'
76+
)
7177
parser.add_argument(
7278
'game',
7379
help="The Pygame Zero game to run (a Python file or directory)."

0 commit comments

Comments
 (0)