So, when you have a GUI framework, it often has it’s own way of managing time. In this case, it’s often best to run the session as a server. See this example:
This example might also be a good one to check out, though it’s a little complicated (it uses PyQt):
You can see in the code that I’ve set the mouse press event to call the Barlicity.start() function, which then instantiates a Session, asks it to run as server, adds some instruments, and forks the playback functions.