找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2720|回复: 2

[求助] 插入pygames小游戏失败

[复制链接]
发表于 2022-3-16 18:04:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我需要插入一个简单的pygames小游戏,但是它了如下的错误:
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
我已经试过了包括但不限于:在游戏中安装pygame,在游戏中安装pygame_sdl2,但是仍未解决。我现在急需解决方法!

constants.zip

3.99 KB, 下载次数: 4, 下载积分: 活力 100

发表于 2022-3-23 05:03:41 | 显示全部楼层
回复 支持 抱歉

使用道具 举报

发表于 2022-3-24 10:51:55 | 显示全部楼层
本帖最后由 怀念丶落樱 于 2022-3-24 10:55 编辑

我认为您不能直接在 ren'py 游戏中运行 pygame 游戏。因为他们的工作方式不同。
或许您可以研究一下'创建者定义的可视组件'
您为何不再 ren'py 中直接构建您的游戏呢?



回复 支持 抱歉

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|RenPy中文空间 ( 苏ICP备17067825号|苏公网安备 32092302000068号 )

GMT+8, 2024-11-22 03:45 , Processed in 0.115420 second(s), 27 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表