where does print go?



  • This was unexpected: If I run this (taken pretty directly from vanilla documentation)

    from vanilla import *
    
    class ButtonDemo(object):
    
         def __init__(self):
             self.w = Window((100, 40))
             self.w.button = Button((10, 10, -10, 20), "A Button",
                                callback=self.buttonCallback)
             self.w.open()
    
         def buttonCallback(self, sender):
             print ("Button callback")
    
    ButtonDemo()
    print ("Print statement")
    

    in the Glyphs.app macro window, all works fine. If I run it in the Drawbot Glyphs plugin window, the “Print statement” appears in the Drawbot console but the “Button callback” appears in the Glyphs console! If I run it in the standalone Drawbot app (which is where I was trying to develop my script) I see “Print statement” in its console, and “Button callback” is nowhere I can see.
    Why are some print statements working in the output window and some not? And are they somewhere else I could monitor?


  • admin

    Your scripts ends at the last line, that is also the moment the "output view" stops listening to print statements of your script.

    However that window is still open and calls print when you hit that button. DrawBot collects all these in a debugger window: use alt+cmd+ ? to open that window (or press alt with the Help menu open.



  • @frederik Got it, thanks.
    I just knew someday my print()s would come! 😁


Log in to reply