调试通过 livewires 运行的 Python pygame
Python 似乎完全忽略了我的对象之一 - games.Text 对象。似乎无法理解为什么,语法似乎是正确的。这是代码。
from livewires import games
#Creating and validating the pygame screen.
myscreen = games.Screen ()
#Loading an image into memory to create an image object
wall_image = games.load_image("wall.jpg", transparent = False)
myscreen.set_background(wall_image)
#Printing Arbitary Score
games.Text(screen = myscreen, x = 500, y = 30,
text = "Score: 1756521",
size = 50, color = color.black)
myscreen.mainloop()
Python seems to completely ignore one of my objects - the games.Text object. Can't seem to understand why, syntax seems correct. Here's the code.
from livewires import games
#Creating and validating the pygame screen.
myscreen = games.Screen ()
#Loading an image into memory to create an image object
wall_image = games.load_image("wall.jpg", transparent = False)
myscreen.set_background(wall_image)
#Printing Arbitary Score
games.Text(screen = myscreen, x = 500, y = 30,
text = "Score: 1756521",
size = 50, color = color.black)
myscreen.mainloop()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的问题似乎是在一些地方拼写错误“颜色”(这个包来自英国),忘记
并且没有注意到错误消息的某种组合:
至少我认为这是你的问题,因为在这些更改之后它运行得很好对我来说,在右上角显示“分数”文本。
Your problem seems to be some combination of misspelling "colour" in a few places (this package is from the UK), forgetting
and failing to notice an error message:
At least I assume that's your problem, because after those changes it runs just fine for me, displaying the "score" text in the top right.