2016-07-29 36 views
0

我有一個livewires.games.Text對象,稱爲分數,我試圖從中獲取值。我試圖將其轉換爲做scores = str(self.scores),甚至一個for循環:從livewires.games.Text對象中獲取值

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()

回答

0

我所要做的就是:

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