本文整理汇总了Python中table.Table.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Table.draw方法的具体用法?Python Table.draw怎么用?Python Table.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table.Table
的用法示例。
在下文中一共展示了Table.draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import draw [as 别名]
class Game(scene.Scene):
def __init__(self, world):
scene.Scene.__init__(self, world)
self.group = group.Group()
self._create_ui()
self.gui = gui.Gui()
self.table = Table(self.gui, self.group, self.turn)
self.gui.add_widgets(self.group.sprites())
self.mouse = gui.Mouse(self.gui)
self.group.add_mouse(self.mouse)
self.background = world.screen.convert()
self.update_view()
def _create_ui(self):
"""Crea la interfaz del juego """
# genera el visor de turnos
self.turn = gui.Turn()
self.group.add(self.turn)
def update(self):
self.group.update()
self._update_view()
def draw(self, screen):
pass
def update_view(self):
""" Actualiza la vista"""
self.table.draw(self.background)
self.world.screen.blit(self.background, (0, 0))
pygame.display.flip()
def _update_view(self):
""" Actualiza la vista"""
self.group.clear(self.world.screen, self.background)
pygame.display.update(self.group.draw(self.world.screen))
def on_event(self, event):
if event.type in common.MOUSE_EVENTS:
self.mouse.send_event(event)
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_b:
self.table.blink_checkers_that_can_move()
elif event.key == pygame.K_u:
#for DEBUG
mov = ask(self.world.screen, "Convertir a Dama")
regular = re.compile(r'^([0-7]),([0-7])$')
if not regular.match(mov):
message = 'Fichas ' + mov + ' invalida'
self.update_view()
else:
r, _, c = tuple(mov)
try:
if self.table.square_occupied((int(r),int(c))):
self.table.convert_to_king((int(r),int(c)))
except ValueError, mesg:
print mesg
finally:
self.update_view()
示例2: Table
# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import draw [as 别名]
import motherboard
from table import Table
motherboard.createWindow(1200, 800)
motherboard.setXscale(0, 1200)
motherboard.setYscale(0, 800)
motherboard.setPenRadius(0.005)
motherboard.rectangle(600, 400, 600, 400)
motherboard.rectangle(600, 770, 600, 30)
motherboard.line(600, 740, 600, 800)
tablelist = []
table1 = Table(600, 400, 100, 170, 1)
tablelist.append(table1)
table1.draw()
table1.orderInput("Chicken")
table1.draw()
table1.orderReady("Chicken")
table1.draw()
table1.
table2 = Table(900, 500, 100, 140, 2)
table2.draw()
table3 = Table(200, 500, 100, 170, 2)
table3.draw()
print len(table1.ordersleft)
while True: