本文整理汇总了Python中song.Song.backgroundColor方法的典型用法代码示例。如果您正苦于以下问题:Python Song.backgroundColor方法的具体用法?Python Song.backgroundColor怎么用?Python Song.backgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类song.Song
的用法示例。
在下文中一共展示了Song.backgroundColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from song import Song [as 别名]
# 或者: from song.Song import backgroundColor [as 别名]
def parse(self):
song = Song()
#song.name = self.name
token = self._tokens.dequeue()
#TODO Parse the file and build a complete Song object to be returned
for x in range(0, self._tokens.size() + 1):
if (token.type == 0 and token.value == "song"):
token = self._tokens.dequeue()
while(token):
if (token.type == 1 and token.value == "song"):
#print("done")
#print(song.verses)
return song
break
elif (token.type == 0 and token.value == "name"):
token = self._tokens.dequeue()
while(token):
if (token.type == 4 or token.type == 2 or token.type == 3):
song.name = str(token.value)
print(token.value)
token = self._tokens.dequeue()
if (token.type == 1 and token.value == "name"):
token = self._tokens.dequeue()
print("hello")
break
else:
print("Parse Error")
break
else:
print("Invalid type for name tag")
break
elif (token.type == 0 and token.value == "backgroundColor"):
token = self._tokens.dequeue()
while(token):
if (self.colors == 3):
self.colors = 0
#print("gettin somewhere")
song.backgroundColor = (self.red, self.green, self.blue)
token = self._tokens.dequeue()
break
elif (token.type == 0 and token.value == "red"):
token = self._tokens.dequeue()
if (token.type == 2 or token.type == 3):
self.red = token.value
self.color = self.color + self.red
self.colors += 1
token = self._tokens.dequeue()
if (token.type == 1 and token.value == "red"):
token = self._tokens.dequeue()
else:
print("Parse Error")
break
else:
print("Parse Error")
break
elif (token.type == 0 and token.value == "blue"):
token = self._tokens.dequeue()
if (token.type == 2 or token.type == 3):
self.blue = token.value
self.color = self.color + (self.blue * 256)
self.colors += 1
token = self._tokens.dequeue()
if (token.type == 1 and token.value == "blue"):
token = self._tokens.dequeue()
else:
print("Parse Error")
break
else:
print("Parse Error")
break
elif (token.type == 0 and token.value == "green"):
token = self._tokens.dequeue()
if (token.type == 2 or token.type == 3):
self.green = token.value
self.color = self.color + (self.green * 256)
self.colors += 1
token = self._tokens.dequeue()
if (token.type == 1 and token.value == "green"):
token = self._tokens.dequeue()
else:
print("Parse Error")
break
else:
print("Parse Error")
break
else:
print("Invalid type for backgroundcolor tag")
break
elif (token.type == 0 and token.value == "soundFile"):
token = self._tokens.dequeue()
while(token):
if (token.type == 4):
song.songFile = token.value
token = self._tokens.dequeue()
if (token.type == 1 and token.value == "soundFile"):
token = self._tokens.dequeue()
break
else:
print("Parse Error")
break
#.........这里部分代码省略.........