本文整理汇总了Python中console.Console.toggle方法的典型用法代码示例。如果您正苦于以下问题:Python Console.toggle方法的具体用法?Python Console.toggle怎么用?Python Console.toggle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类console.Console
的用法示例。
在下文中一共展示了Console.toggle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from console import Console [as 别名]
# 或者: from console.Console import toggle [as 别名]
class Application:
entitylist = [[],[],[]] # 2D array - [0] er bak, [1] er player, [2] er forran
def __init__(self):
self.width = getWidth()
self.height = getHeight()
self.fps = getFPS()
self.bubbleCount = int(getWidth() / 160)
self.drawBubbles = True
self.drawBG = True
pygame.init()
self.fpsClock = pygame.time.Clock()
if fullscreen():
self.windowSurfaceObj = pygame.display.set_mode((self.width, self.height), pygame.FULLSCREEN)
else:
self.windowSurfaceObj = pygame.display.set_mode((self.width, self.height))
pygame.display.set_caption('Anim')
pygame.mouse.set_visible(cursor())
for i in range(0, self.bubbleCount):
self.entitylist[2].append(Bubble(True))
self.entitylist[0].append(Bubble(False))
self.player = Player()
self.entitylist[1].append(self.player)
self.background = Background()
print('Init...')
self.console = Console(getWidth(), getHeight())
Console.host = self
self.DrawPosVector = False
def event(self):
self.events = pygame.event.get()
for event in self.events:
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYUP:
if event.key == K_ESCAPE:
print('Exiting...')
self.exit()
if event.type == KEYDOWN:
if event.key == K_F12:
self.console.toggle()
elif self.console.isActive():
if event.key == K_RETURN:
self.console.execute()
break
elif event.key == K_BACKSPACE:
self.console.setCurrentLine(self.console.getCurrentLine()[:-1])
break
self.console.appendCurrentLine(event.unicode)
return
self.background.dirVector.setX(-(self.player.getXSpeed() / 8))
self.background.event(self.events)
for lst in self.entitylist:
for e in lst:
if isinstance(e, Bubble):
e.setXSpeedFromPlayer(-self.player.getXSpeed())
e.event(self.events)
def render(self):
#Background
if self.drawBG: self.background.render(self.windowSurfaceObj)
for lst in self.entitylist:
for e in lst:
e.render(self.windowSurfaceObj, self.DrawPosVector)
#Konsollen
self.console.render(self.windowSurfaceObj)
pygame.display.update()
self.fpsClock.tick(getFPS())
def exit(self):
pygame.event.post(pygame.event.Event(QUIT))
def fullscreen(self, input):
if input:
self.windowSurfaceObj = pygame.display.set_mode((self.width, self.height), pygame.FULLSCREEN)
else:
self.windowSurfaceObj = pygame.display.set_mode((self.width, self.height))