本文整理汇总了Python中table.Table.show方法的典型用法代码示例。如果您正苦于以下问题:Python Table.show方法的具体用法?Python Table.show怎么用?Python Table.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.show方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import show [as 别名]
def login(self, *args):
global w
name = w.loginEdit.text()
password = w.passwordEdit.text()
if User.login(name, password):
w = Table()
w.show()
示例2: login
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import show [as 别名]
def login(*args):
global w
name = w.loginEdit.text()
password = w.passwordEdit.text()
if User.login(name, password):
ret = QMessageBox.question(w, 'Приветствие', 'Ура, Вы вошли!',
QMessageBox.Ok)
if ret == QMessageBox.Ok:
w = Table()
w.show()
示例3: handleSit
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import show [as 别名]
def handleSit(self, tableSeatCell):
# Not a seat column
if tableSeatCell.column() == 0:
return
self.logger.append("Joining table %d, seat %d" % (tableSeatCell.tableId,
tableSeatCell.seat))
table_id = tableSeatCell.tableId
seat_num = tableSeatCell.seat
try:
self.server.sit(table_id, seat_num)
table = Table(table_id, seat_num, self.server, self.logger,
self.resource_path)
self.tables.append(table)
table.show()
self.tablesTable.updating()
except InvalidOperation as exc:
self.logger.append("<b>Failed: %s</b>" % (str(exc)))
示例4: __init__
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import show [as 别名]
class Game:
def __init__(self, n_players, interactive=False):
""" Build game of Hanabi. Make the deck, draw cards
Args:
n_players: How many players
interactive: If true, shows the state of game to console at every turn
"""
if n_players not in CARDS_PER_PLAYER:
raise Exception("Num players must be between 2 and 5")
self.deck = Deck()
self.players = []
# Game is over is num fuse or num clock tokens goes below zero
self.cur_player = 0
self.interactive = interactive
self.table = Table()
self.num_turns_left = None
for i in xrange(n_players):
self.players.append(Player(self.deck.draw_cards(CARDS_PER_PLAYER[n_players]), "player {}".format(i), i))
def say(self, idx, param):
""" Give a piece of information to a player
:param idx: The index of the player receiving hteinformation
:param param: The information being received (either a color or a number)
:return: None
"""
try:
number = int(param)
self.players[idx].receive_number_info(number)
except ValueError:
self.players[idx].receive_color_info(param)
self.table.num_clock_tokens -= 1
def _do_discard(self, cur_player_object, idx):
logger.debug("{} discarding {}".format(cur_player_object.name, cur_player_object.cards[idx]))
cur_player_object.discard(idx, self.table)
cur_player_object.draw_card(self.deck)
def _do_play_card(self, cur_player_object, idx):
logger.debug("{} playing {}".format(cur_player_object.name, cur_player_object.cards[idx]))
cur_player_object.play(idx, self.table)
cur_player_object.draw_card(self.deck)
def _do_say(self, cur_player_object, params):
idx, arg = params
if self.table.num_clock_tokens == 0:
raise Exception("player {} called 'say' with no information tokens left".format(self.cur_player))
if idx == self.cur_player:
raise Exception("player {} is trying to tell itself information".format(idx))
# TODO: you can never give information about 0 cards. Throw exception
logger.debug("{} saying {},{}".format(cur_player_object.name, idx, arg))
self.say(idx, arg)
def _do_turn(self):
""" Execute a single turn in the game
:return:
"""
if self.strategy is None:
raise Exception("doTurn called but no player strategy specified")
# do the turn
other_players = [p for i, p in enumerate(self.players) if i != self.cur_player]
cur_player_object = self.players[self.cur_player]
method, params = self.strategy.do_turn(self.cur_player,
cur_player_object.guesses,
other_players,
self.table,
logger)
if method == "discard":
self._do_discard(cur_player_object, int(params))
elif method == "play":
self._do_play_card(cur_player_object, int(params))
elif method.startswith("say"):
self._do_say(cur_player_object, params)
else:
raise Exception("Invalid command returned from strategy.doTurn: {}", method)
# check if deck is empty, if so, don't draw, instead start countdown
if self.deck.is_empty():
if self.num_turns_left is None:
self.num_turns_left = len(self.players)
else:
self.num_turns_left -= 1
self.cur_player += 1
self.cur_player %= len(self.players)
def _is_game_over(self):
""" Check whether game is over
Ways game can be over:
deck is empty and n_players moves have been executed
#.........这里部分代码省略.........