MainloopFeedback — Base Class for Feedbacks with a Mainloop

class FeedbackBase.MainloopFeedback.MainloopFeedback(port_num=None)

Mainloop Feedback Base Class.

This feedback derives from the Feedback Base Class and implements a main loop. More specifically it implements the following methods from it’s base:

on_init on_play on_pause on_stop on_quit

which means that you should not need to re-implement those methods. If you choose to do so anyways, make sure to call MainloopFeedback’s version first:

def on_play():
MainloopFeedback.on_play(self) # your code goes here

MainloopFeedback provides the following new methods:

init pre_mainloop post_mainloop tick pause_tick play_tick

the class takes care of the typical steps needed to run a feedback with a mainloop, starting, pausing, stopping, quiting, etc.

While running it’s internal mainloop it calls tick repeatedly. Additionally it calls either play_tick or pause_tick repeatedly afterwards, depending if the Feedback is paused or not.

init()

Called at the beginning of the Feedback’s lifecycle.

More specifically: in Feedback.on_init().

pause_tick()
Called repeatedly in the mainloop if the Feedback is paused.
play_tick()
Called repeatedly in the mainloop if the Feedback is not paused.
post_mainloop()
Called after leaving the mainloop, e.g. after stop or quit.
pre_mainloop()
Called before entering the mainloop, e.g. after on_play.
tick()
Called repeatedly in the mainloop no matter if the Feedback is paused or not.

Module author: Bastian Venthur <venthur@cs.tu-berlin.de>

Previous topic

Feedback — Feedback Base Class

Next topic

PygameFeedback — PygameFeedback Base Class

This Page