英文:
How to use function in Show() in Renpy?
问题
How can I display my dictionary on another screen?
define python:
heroes = { Someone : 1, Someone: 2}
screen showBio(id, dict):
frame:
xsize 300
ysize 300
vbox:
text "[dict[id]]"
screen characters():
tag menu
use game_menu(_("Heroes"), scroll="viewport"):
for i in heroes:
textbutton "[i]" action Show("showBio([i], [heroes])")
英文:
How can I display my dictionary on another screen?
define python:
heroes = { Someone : 1, Someone: 2}
screen showBio(id, dict):
frame:
xsize 300
ysize 300
vbox:
text "[dict[id]]"
screen characters():
tag menu
use game_menu(_("Heroes"), scroll="viewport"):
for i in heroes:
textbutton "[i]" action Show("showBio([i], [heroes])")
答案1
得分: 0
Here is the translated code:
定义 python:
英雄 = {"某人": 1, "某人2": 2}
屏幕 显示生物(id, 英雄字典):
框架:
x尺寸 300
y尺寸 300
竖盒:
文本 str(英雄字典[id])
屏幕 角色():
标签 菜单
使用 游戏菜单(_("英雄"), 滚动="视口"):
对于 i 在 英雄:
文本按钮 i 操作 显示("显示生物", i, 英雄字典=英雄)
Please note that I've translated the code portion, as requested. If you have any specific questions or need further assistance, feel free to ask.
英文:
define python:
heroes = {"Someone": 1, "Someone2": 2}
screen showBio(id, hero_dict):
frame:
xsize 300
ysize 300
vbox:
text str(hero_dict[id])
screen characters():
tag menu
use game_menu(_("Heroes"), scroll="viewport"):
for i in heroes:
textbutton i action Show("showBio", i, hero_dict=heroes)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论