本文整理汇总了Python中interface.Interface.update方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.update方法的具体用法?Python Interface.update怎么用?Python Interface.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interface.Interface
的用法示例。
在下文中一共展示了Interface.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import update [as 别名]
def main():
pygame.init() # Инициация PyGame, обязательная строчка
screen = pygame.display.set_mode(DISPLAY) # Создаем окошко
pygame.display.set_caption("Alert system") # Пишем в шапку
clock = pygame.time.Clock()
fps = 30
interface = Interface(BACKGROUND_COLOR, DISPLAY)
while 1: # Основной цикл программы
for e in pygame.event.get(): # Обрабатываем события
keys = pygame.key.get_pressed()
if keys[pygame.K_f]:
interface.mode = interface.FIRE_MODE
elif keys[pygame.K_c]:
interface.mode = interface.CHEM_MODE
elif keys[pygame.K_v]:
interface.mode = interface.INACTIVE_MODE
if True in mouse.get_pressed():
pos = mouse.get_pos()
if pos[0] < 1000:
interface.new_object(pos)
if e.type == QUIT:
raise SystemExit("QUIT")
interface.update()
screen.blit(interface.image, (0, 0)) # Каждую итерацию необходимо всё перерисовывать
pygame.display.update() # обновление и вывод всех изменений на экран
clock.tick_busy_loop(fps)
示例2: and
# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import update [as 别名]
#When spacebar is release fire the shot at selected power
elif event.type == pygame.KEYUP and (event.key == pygame.K_SPACE):
main_interface.release_power()
# get key current state
keys = pygame.key.get_pressed()
if keys[K_LEFT]:
main_interface.move_tank("left")
if keys[K_RIGHT]:
main_interface.move_tank("right")
if keys[K_UP]:
main_interface.change_angle("up")
if keys[K_DOWN]:
main_interface.change_angle("down")
main_interface.update()
fpsClock.tick(60)
"""
Connection to arduino was successful so play the game with the arduino controller
"""
print("Connection to Arduino Successful")
start = True
while True:
"""
Infinite Game loop for playing with the arduino controller
"""
arduino_input = serial_connection.read().decode('ASCII')
示例3: Interface
# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import update [as 别名]
#!/usr/bin/python
from interface import Interface
from threads import *
if __name__ == "__main__":
# Initialize the interface
interface = Interface()
# Initialize the calculations thread
calculations = CalcThread(interface)
# Let interface know about calc thread so it can display speed
interface.setCalcThread(calculations)
# Start the calc thread
calculations.start()
# Run the interface updates
while (interface.update()):
pass
exit()