Exemple #1
0
#from multiprocessing.connection import Client, Listener

#address = ('localhost', 6000)     # family is deduced to be 'AF_INET'


while True:    
    Idle = True
    Redraw = True
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
            Idle = True
        elif event.type == pygame.MOUSEBUTTONDOWN:
            mousecoords = mouseCoordsToComplexCoords(Coords)
            Coords = moveWindow(Coords,mousecoords[0],mousecoords[1])
            Idle = False
   
    if Idle:
        messenger.talk("Idle","broadcast")
    messageIn = messenger.listen()
    if not messageIn:
        print(messageIn)
        Idle = False
###  Create the event 
    print("colorBands:",colorBands,"Iterations:",iterations) 
    REDRAW = False
    if REDRAW == True:
        brot(Coords,iterations,frameCount)
        frameCount = frameCount + 1
        print(Coords)
Exemple #2
0
screen.fill(HexColorRandom())

while True:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()

        elif event.type == pygame.KEYDOWN:
            mods = pygame.key.get_mods()
            if event.key == pygame.K_ESCAPE:
                sys.exit()
                
    time.sleep(0.5)

    messenger.talk("Are you There display?","broadcast")
    print(messenger.listen())

"""    
    try:    
        with Listener(address, authkey=b'secret password') as listener:
            with listener.accept() as conn:
                print('connection accepted from', listener.last_accepted)
                message = time.strftime("%Y%m%d")
                message = message + "_"
                message = message + time.strftime("%H%M%S")
                conn.send(message)
    except:
        print("No receivers detected")
    try:
        with Client(address, authkey=b'secret password') as conn: