Skip to content

Instantly share code, notes, and snippets.

@HuangJiaLian
Created March 31, 2022 14:05
Show Gist options
  • Save HuangJiaLian/7dce30b3d48e0117839b404783517c68 to your computer and use it in GitHub Desktop.
Save HuangJiaLian/7dce30b3d48e0117839b404783517c68 to your computer and use it in GitHub Desktop.
Show labels of tempo and tempo marking
# Function to determine the tempo markings
def tempo_marking_of(tempo):
for key in markings.keys():
if tempo >= markings[key][0] and tempo <= markings[key][1]:
marking = key
break
else:
marking = ''
return marking
# When scale changes
def update(*args):
global scale_var, time_signature, interval_ms, tempo, tempo_label, marking_label
tempo = scale_var.get()
interval_ms = int((60/tempo) * (4/time_signature[-1]) * 1000)
tempo_label['text'] = '{}'.format(tempo)
marking = tempo_marking_of(tempo)
marking_label['text'] = '{}'.format(marking)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment