The mathematics of defining the tempo of a rhythm is simple. We get the value associated with the beats_per_minute attribute and divide it by 60 to get the beats per second. Then, the time to play each beat (or group of beats simultaneously for a given column) is the reciprocal of beats_per_second.
The code is as follows (see code 3.06.py):
def time_to_play_each_column(self): beats_per_second = self.beats_per_minute/60 time_to_play_each_column = 1/beats_per_second return time_to_play_each_column
While we are handling the tempo for the pattern, let's also complete coding of the command callback attached to our beats per minute Spinbox widget (see code 3.06.py):
def on_beats_per_minute_changed(self): self.beats_per_minute ...