I need to insert a simple pygames minigame, but it gives the following error:
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 2, in script
init python:
File "game/script.rpy", line 2, in script
init python:
File "game/script.rpy", line 3, in <module>
import main
NotImplementedError: Could not import pygame_sdl2.font: No module named 'pygame_sdl2.font'
-- Full Traceback -------------------------------------------------------- --------------
Full traceback:
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\bootstrap.py", line 284, in bootstrap
renpy.main.main()
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\main.py", line 557, in main
renpy.game.context().run(node)
File "game/script.rpy", line 2, in script
init python:
File "/home/tom/ab/nightly-build/tmp/install.linux-x86_64/lib/python3.9/site-packages/future/utils/__init__.py", line 441, in raise_
File "game/script.rpy", line 2, in script
init python:
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\ast.py", line 943, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\python.py", line 872, in py_exec_bytecode
exec(bytecode, globals, locals)
File "game/script.rpy", line 3, in <module>
import main
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\loader.py", line 991, in load_module
exec(code, mod.__dict__) # type: ignore
File "main.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\loader.py", line 991, in load_module
exec(code, mod.__dict__) # type: ignore
File "game_wuziqi.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "D:\renpy\renpy-8-nightly-2022-03-13-e4896d675-sdk\renpy\loader.py", line 991, in load_module
exec(code, mod.__dict__) # type: ignore
File "constants.py", line 4, in <module>
File "/home/tom/ab/nightly-build/tmp/install.linux-x86_64/lib/python3.9/site-packages/pygame_sdl2/__init__.py", line 33, in __getattr__
NotImplementedError: Could not import pygame_sdl2.font: No module named 'pygame_sdl2.font'
Windows-10-10.0.22000
Ren'Py 8.0.0.22031201n
ThreeKingdoms_game 1.0
Wed Mar 16 17:58:40 2022
In fact, I just imported this py file and called the start method.
I've tried including but not limited to: installing pygame in the game, installing pygame_sdl2 in the game, but it still doesn't work out. I desperately need a solution now!
Failed to insert pygame minigame!
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Failed to insert pygame minigame!
- Attachments
-
- Games(1).zip
- (8.94 MiB) Downloaded 4 times
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Failed to insert pygame minigame!
I don't think you can run a pygame game directly in a ren'py game. They work differently.
Possibly you could open a pygame game from within a ren'py game and have the pygame run in a separate window as a pygame window.
I think that to include a game made in pygame you need to rewrite the code.
You have something called creator-Defined Displayables that might be the way to go.
https://www.renpy.org/doc/html/cdd.html
When the events are pushing a button you could probably do a lot just with screen commands.
Who is online
Users browsing this forum: No registered users