本文整理汇总了Python中Console.getconsole方法的典型用法代码示例。如果您正苦于以下问题:Python Console.getconsole方法的具体用法?Python Console.getconsole怎么用?Python Console.getconsole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console.getconsole方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Console [as 别名]
# 或者: from Console import getconsole [as 别名]
def __init__(self, server_ip,
server_port=5555,
wait_time=None,
isSafe=True,
printStates=True,
aiType=False):
## @cond KEYBOARD_CONSTANTS
self.keyLeft = 75
self.keyRight = 77
self.keyUp = 72
self.keyDown = 80
## @endcond
## @var self.isAI
# False if human-controlled
self.isAI = aiType
## @var self._holding
# A queue for messages recieve while the game is not yet in play
self._holding = Queue.Queue()
## @var self._msgs
# A queue for the messages recieved
self._msgs = Queue.Queue()
## @var self._play
# A boolean to trigger the game play. Game loop won't run until true
self._play = False
## @var self._numPlayers
# The number of players currently in the game
self._numPlayers = 1
## @var self._states
# A dictionary of all the players states
self._states = {}
## @var self._shouldPrint
# A toggle for the state printing
self._shouldPrint = printStates
## @var self._c
# A Client object
self._c = client.client(server_ip, server_port, self._handleMsg, self._playerAdded, self._playerRemoved, self._newLeader,isSafe)
players = self._c.findGame()
## @var self.gameOver
#game is over
self.gameOver = False
## @var self.gameCon
#better control of the screen
self.gameCon = Console.getconsole()
if not players:
self._states[self._c.getSelf()] = state(sops['PACMAN'])
inputThread = threading.Thread(target=self._input)
inputThread.daemon = True
inputThread.start()
self._run(server_ip, server_port, wait_time, isSafe, printStates)
示例2: raw_input
# 需要导入模块: import Console [as 别名]
# 或者: from Console import getconsole [as 别名]
def raw_input(prompt=None, c=None):
'''\b -> String'''
if (prompt != None):
print(prompt)
if (c == None):
import Console
c = Console.getconsole()
buf = ""
while True:
b = c.get()
if (b.type == 'KeyPress'):
if (b.keycode == 13):
print("")
break
elif (b.keycode == 8):
buf = buf[:-1]
print("[BS]")
elif (b.keycode == 9):
buf += '\t'
print('\t')
elif (b.keycode == 32):
buf += ' '
print(' ')
elif (b.keycode in range(48, 57)):
buf += b.char
print(b.char)
elif (b.keycode in range(65, 90)):
buf += b.char
print(b.char)
elif (b.keycode in range(96, 111)):
buf += b.char
print(b.char)
elif (b.keycode > 187):
buf += b.char
print(b.char)
return buf
示例3: print
# 需要导入模块: import Console [as 别名]
# 或者: from Console import getconsole [as 别名]
import Console
c = Console.getconsole()
c.cursor(0)
c.title("Console Example")
c.text(0, 0, "here's some white text on white background", 0x1f)
c.text(10, 5, "line five, column ten")
#c.getchar()
c.pos(0, 6)
c.cursor(1)
while True:
b = c.get()
print(b.char)
print(b.keycode)
print(b.type)
#print(b.keysym)
print("")
示例4: to
# 需要导入模块: import Console [as 别名]
# 或者: from Console import getconsole [as 别名]
#print "Update color to (R:%d G:%d B:%d)" % (color[0], color[1], color[2])
r = tobyte(color[0])
g = tobyte(color[1])
b = tobyte(color[2])
packet = struct.pack('cBBB', 'X', r,g,b)
#print packet
self.ser.write(packet)
########## CODE ################################################################
TITLE = "Audio Visualizer"
INK = 0x1f
# Set up console
console = Console.getconsole(0)
console.title(TITLE)
console.text(0, 0, chr(0xfe) + ' ' + TITLE + ' ' + chr(0xfe))
console.text(0, 1, chr(0xcd) * 80)
# Create LPF filter
# norm_pass = 2*math.pi*CUTOFF_FREQ/SAMPLE_RATE
# norm_stop = 1.5*norm_pass
# (N, Wn) = signal.buttord(wp=norm_pass, ws=norm_stop, gpass=2, gstop=30, analog=0)
# (b, a) = signal.butter(N, Wn, btype='low', analog=0, output='ba')
# b *= 1e3
# Open Audio stream (uses default audio adapter)
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16,channels=1,\
示例5: Stop
# 需要导入模块: import Console [as 别名]
# 或者: from Console import getconsole [as 别名]
def Stop(hStopEvent):
try:
cons=Console.getconsole(0)
except Exception, details:
print "The following Error has been detected:%s..."%edetails
示例6: __init__
# 需要导入模块: import Console [as 别名]
# 或者: from Console import getconsole [as 别名]
def __init__(self):
self.console = Console.getconsole()