Пример #1
0
        return ssids

    def showLabel(self, msg, x, y):
        (surface, rect) = self.createLabel(msg, x, y)
        self.displaySurface.blit(surface, rect)


if __name__ == "__main__":
    print("pygame.init")
    pygame.init()
    BIGFONT = pygame.font.Font('freesansbold.ttf', 32)
    DISPLAYSURF = pygame.display.set_mode((1200, 800))
    utilities = Utilities(DISPLAYSURF, BIGFONT)
    from Communications import Communications

    comm = Communications('messages', 'localhost', 'laptop')
    if comm.connectBroker():
        comm.setTarget('pi7')
        utilities.comm = comm

        sprites = utilities.showImages(['quit.jpg'], [(400, 500)])
        pygame.display.update()

        quit = False
        while not quit:
            (event, data, addr) = utilities.getKeyOrMqtt()
            if utilities.message != '':
                print('[message]: [' + utilities.message + ']')
                utilities.message = ''

            # Use data above to determine sprite click?
Пример #2
0

if __name__ == '__main__':
    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()
Пример #3
0
BROWN = (174, 94, 0)
RED = (255, 0, 0)

TEXTBGCOLOR1 = BRIGHTBLUE
TEXTBGCOLOR2 = GREEN
GRIDLINECOLOR = BLACK
TEXTCOLOR = WHITE
HINTCOLOR = BROWN

tcpSocket = None
tcpConnection = None
client = None

print("pygame.init")
pygame.init()
print("get the clock")
MAINCLOCK = pygame.time.Clock()

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