本文整理汇总了Python中module.Module.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Module.draw方法的具体用法?Python Module.draw怎么用?Python Module.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module.Module
的用法示例。
在下文中一共展示了Module.draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JumpGame
# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import draw [as 别名]
#.........这里部分代码省略.........
JumpGame.trainingMousePressed(self,event)
elif(self.mode == "race"):
JumpGame.raceMousePressed(self,event)
def keyPressed(self,event):
if (self.mode == "mainmenu"):
JumpGame.mainmenuKeyPressed(self,event)
elif (self.mode == "spacejump"):
JumpGame.spacejumpKeyPressed(self,event)
elif (self.mode == "instructions"):
JumpGame.instructionsKeyPressed(self,event)
elif (self.mode == "instructions2:"):
JumpGame.instructionstwoKeyPressed(self,event)
elif (self.mode == "training"):
JumpGame.trainingKeyPressed(self,event)
elif(self.mode=="race"):
JumpGame.raceKeyPressed(self,event)
def timerFired(self):
if (self.mode == "mainmenu"):
JumpGame.mainmenuTimerFired(self)
elif (self.mode == "spacejump"):
JumpGame.spacejumpTimerFired(self)
elif (self.mode == "instructions"):
JumpGame.instructionsTimerFired(self)
elif (self.mode == "instructionstwo"):
JumpGame.instructionstwoTimerFired(self)
elif (self.mode == "training"):
JumpGame.trainingTimerFired(self)
elif (self.mode == "race"):
JumpGame.raceTimerFired(self)
def redrawAll(self):
if (self.mode == "mainmenu"):
JumpGame.mainmenuRedrawAll(self)
elif (self.mode == "spacejump"):
JumpGame.spacejumpRedrawAll(self)
elif (self.mode == "instructions"):
JumpGame.instructionsRedrawAll(self)
elif (self.mode == "instructionstwo"):
JumpGame.instructionstwoRedrawAll(self)
elif (self.mode == "training"):
JumpGame.trainingRedrawAll(self)
elif (self.mode == "race"):
JumpGame.raceRedrawAll(self)
###### main menu ######
def mainmenuMousePressed(self,event):
# if click is in range, then change mode.
if event.x > self.width//2-30 and event.x < self.width//2+30 and\
event.y > self.height//2-15 and event.y < self.height//2+15:
self.mode = "spacejump"
elif event.x > self.width//2-45 and event.x < self.width//2+45 and\
event.y>self.height//2+30 and event.y<self.height//2+60:
self.mode = "instructions"
elif event.x >= self.width//2-40 and event.x <= self.width//2+40 and\
event.y>=self.height//2+75 and event.y<=self.height//2+105:
self.mode = "training"
elif event.x >= self.width//2-30 and event.x <= self.width//2+30 and\
event.y>=self.height//2+120 and event.y<=self.height//2+150:
self.mode = "race"