Пример #1
0
    from Utilities import Utilities
    import platform
    from Communications import Communications
    pygame.init()

    DISPLAYSURF = pygame.display.set_mode((1200, 800))
    FONT = pygame.font.Font('freesansbold.ttf', 16)
    BIGFONT = pygame.font.Font('freesansbold.ttf', 32)
    pygame.display.set_caption('Flippy')
    utilities = Utilities(DISPLAYSURF, BIGFONT)
    name = 'laptop' if (platform.system() == 'Windows') else 'pi7'
    target = 'pi7' if (platform.system() == 'Windows') else 'laptop'
    comm = Communications('messages', 'localhost', name)
    comm.connectBroker()
    comm.setTarget(target)
    utilities.comm = comm

    line = TextBox('Enter exit to quit')
    pos = line.draw()
    line = TextBox('Chat:')
    pos = line.draw(pos)

    pygame.display.flip()
    run = True
    lastMsg = ''
    line = None
    while run:
        (event, data, addr) = utilities.getKeyOrMqtt()
        print('[event,data,addr]: [' + str(event) + ',' + str(data) + ',' +
              str(addr) + ']')
        if event == pygame.MOUSEBUTTONUP: