【问题标题】:get value from livewires.games.Text object从 livewires.games.Text 对象获取值
【发布时间】:2016-07-29 01:26:15
【问题描述】:

我有一个名为 score 的 livewires.games.Text 对象,我试图从中获取价值。我已经尝试将其转换为 scores = str(self.scores) 甚至是 for 循环:

scores = str(self.score)
for item in scores:
    print(item)

我得到的只是<livewires.games.Text object at 0x1017aca58>

我正在尝试将分数转换为int(),以便我可以在我正在开发的游戏中使用它来提升我的等级。

以前有没有人使用过 livewires 有没有办法将 <livewires.games.Text object at 0x1017aca58> 变成 int()

【问题讨论】:

    标签: python-3.x livewires


    【解决方案1】:

    我所要做的就是:

            score = self.score.value
            if score % 100 == 0:
                self.level += 1
                games.screen.add(self.level_msg)
    

    【讨论】:

      猜你喜欢
      • 2015-01-11
      • 1970-01-01
      • 1970-01-01
      • 2011-02-21
      • 2016-01-29
      相关资源
      最近更新 更多