calico.display() not working inside event handlers

Issue #173 on hold
Keith O'Hara created an issue

calico.display() not working inside event handlers.

from Processing import *
window(500, 500)
def g():
    calico.display("test") 
onMouseDragged += g
loop()

Comments (7)

  1. Doug Blank

    This doesn't work for me either:

    from Processing import *
    window(500, 500)
    def g():
        print("test") 
    onMouseDragged += g
    loop()
    

    This looks to be a problem with the Processing library, yes?

  2. Doug Blank

    This works:

    from Processing import *
    window(500, 500)
    def g():
        global x
        x += 1 
    onMouseDragged += g
    loop()
    

    and x increases.

  3. Doug Blank

    Output in other threads don't seem to make it to the output. This works:

    import threading
    import datetime
    import time
    
    class ThreadClass(threading.Thread):
        def run(self):
            x = 1
            while True:
                print(x)
                x += 1
                time.sleep(1)
    
    t = ThreadClass()
    t.start()
    t.join()
    

    But remove the t.join() and it doesn't output.

  4. Doug Blank

    I don't think IPython was designed to work this way. Trying some examples in regular IPython, it works similarly to how it works in ICalico (actually ICalico works a bit better). I think when the execution is complete, it stops listening for additional data coming in.

    In IPython you can get the printout if you:

    while True:
        pass
    

    and then interrupt, you see output. In ICalico, you'll see the data without having to interrupt.

  5. Doug Blank

    This is on hold until IPython changes their API. Actually, when they do, it will probably just start working.

  6. Log in to comment