本文整理汇总了Python中Player.play方法的典型用法代码示例。如果您正苦于以下问题:Python Player.play方法的具体用法?Python Player.play怎么用?Python Player.play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.play方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RunTest
# 需要导入模块: import Player [as 别名]
# 或者: from Player import play [as 别名]
def RunTest(self):
TestPlayer=Player()
GestureTestPlayer=TestPlayer.play()
assert GestureTestPlayer.nValue==1 or GestureTestPlayer.nValue==2 or GestureTestPlayer.nValue==3, 'incorrect class player'
print("Test on player class is successful\n")
示例2: print
# 需要导入模块: import Player [as 别名]
# 或者: from Player import play [as 别名]
#Main file for Rock Paper Scissor Game
#Run this file
from Paper import *
from Rock import *
from Scissors import *
from Player import *
ScoreCard=[0]*2 #Initializing score card fpr two players
bWantToPlay=True #Variable: Does the human player wants to play or not
print("Let's play rock paper scissors")
while(bWantToPlay):
Player1=Player() #Creating Player 1 using Player Class
GesturePlayer1=Player1.play() #Asking for gesture of computer player
Player2=HumanPlayer() #Creating Player 2 using HumanPlayer Class
#Asking User for gesture rock/paper/scissor
GesturePlayer2=Player2.play()
if(GesturePlayer2==False):
GesturePlayer2=Player2.play()
#Comparing the gestures of both players
Compare=GesturePlayer2.cmp(GesturePlayer1)
if(Compare=='Same'): #if both gestures are same, the match is draw
ScoreCard[0]=ScoreCard[0]+1
ScoreCard[1]=ScoreCard[1]+1
print("This game is draw")
print("Computer's gesture is",GesturePlayer1.printf())
print("Your gesture is",GesturePlayer2.printf())
示例3: __init__
# 需要导入模块: import Player [as 别名]
# 或者: from Player import play [as 别名]
#.........这里部分代码省略.........
self.menuRemove = self.builderXAC.get_object("menuRemove")
self.cmdPurge = self.builderXAC.get_object("cmdPurge")
self.menuPurge = self.builderXAC.get_object("menuPurge")
self.menuSelectAll = self.builderXAC.get_object("menuSelectAll")
self.menuUnselectAll = self.builderXAC.get_object("menuUnselectAll")
self.cmdRip = self.builderXAC.get_object("cmdRip")
self.menuRip = self.builderXAC.get_object("menuRip")
self.cmdConvert = self.builderXAC.get_object("cmdConvert")
self.menuConvert = self.builderXAC.get_object("menuConvert")
self.menuProperty = self.builderXAC.get_object("menuProperty")
self.menuModify = self.builderXAC.get_object("menuModify")
self.menuPlaylist = self.builderXAC.get_object("menuPlaylist")
self.popProperty = self.builderXAC.get_object("popProperty")
self.popTagger = self.builderXAC.get_object("popTagger")
# Rende insensibili alcuni menu e pulsanti all'avvio
self.set_sensitive(False)
self.cmdRip.set_sensitive(False)
self.cmdConvert.set_sensitive(False)
# Carica la progressbar per la conversione e la nasconde all'avvio
self.progConvert = self.builderXAC.get_object("progressbar")
self.progConvert.hide()
# Crea l'oggetto lista dei file
self.audioFileList = FileList()
# Istanza del player audio
self.player = Player(None, self)
self.player.set_volume(self.volumebutton.get_value())
self.player_bus = self.player.bus
self.player_bus.connect("message::eos", self.on_endPlay)
self.player_bus.connect("message::error", self.on_endError)
# Carica le preferenze
self.prefs = Preferences()
# Funzione che attiva la finestra principale
def main(self):
Gtk.main()
# Funzione che modifica la barra di stato
def set_status(self, text=None):
self.status.show()
con_id = self.status.get_context_id("SB")
if not text:
text = "Ready"
self.mainWindow.set_title(WINDOW_TITLE)
self.status.push(con_id, text)
#print text
while Gtk.events_pending():
Gtk.main_iteration()
# Funzione che rende sensibili/insensibili alcuni menu e pulsanti
def set_sensitive(self, sensitive):
cmd = [
self.cmdPlay,
self.menuPlay,
self.popPlay,