- scales = [ {"name": "Major", "formula" : [2, 2, 1, 2, 2, 2, 1], "chords": "I ii iii IV V vidim vii"},
- {"name": "Harmonic Minor", "formula" : [2, 1, 2, 2, 1, 3, 1],
- "chords": "i iidim IIIaug iv V VI viidim"},
- {"name": "Natural Minor", "formula" : [2, 1, 2, 2, 1, 2, 2], "chords": "i iidim III iv v VI VII"},
- ]
-
- def __init__(self, master=None, app=None):
- Frame.__init__(self, master)
- self.app = app
- self.grid()
- self.createWidgets(master)
- self.currentSelec = None
- self.poll()
-
- def closure(self, text):
- def handler():
- global current_scale, current_mode
- current_mode = modes[text]
- print "current scale %s, current mode %s" % (current_scale, current_mode)
- s = Scale(scale=current_scale, mode=current_mode)
- self.app.outputLabel.configure(text=str(s))
- return handler
-
-
- def createWidgets(self, master):
- self.listbox = Listbox(master)
- for scale in self.scales:
- self.listbox.insert(END, scale["name"])
- self.listbox.grid()
-
- def poll(self):
- # necessary because of a limitation
- # of tkinter
-
- global current_scale # ok, crappy design.
- now = self.listbox.curselection()
- #if now != self.currentSelec and now != ():
- if now != ():
- self.app.updateWidgets(self.scales[int(now[0])], current_scale)
- self.currentSelec = now
- self.after(250, self.poll)
-
- def update(self, currentSelection):
- # notify the parent class of the change
- # in the list
- return
+ scales = [ {"name": "Major", "formula" : [2, 2, 1, 2, 2, 2, 1], "chords": "I ii iii IV V vidim vii"},
+ {"name": "Harmonic Minor", "formula" : [2, 1, 2, 2, 1, 3, 1],
+ "chords": "i iidim IIIaug iv V VI viidim"},
+ {"name": "Natural Minor", "formula" : [2, 1, 2, 2, 1, 2, 2], "chords": "i iidim III iv v VI VII"},
+ ]
+
+ def __init__(self, master=None, app=None):
+ Frame.__init__(self, master)
+ self.app = app
+ self.grid()
+ self.createWidgets(master)
+ self.currentSelec = None
+ self.poll()
+
+ def closure(self, text):
+ def handler():
+ global current_scale, current_mode
+ current_mode = modes[text]
+ print(f"current scale {current_scale}, current mode {current_mode}")
+ s = Scale(scale=current_scale, mode=current_mode)
+ self.app.outputLabel.configure(text=str(s))
+ return handler
+
+
+ def createWidgets(self, master):
+ self.listbox = Listbox(master)
+ for scale in self.scales:
+ self.listbox.insert(END, scale["name"])
+ self.listbox.grid()
+
+ def poll(self):
+ # necessary because of a limitation
+ # of tkinter
+
+ global current_scale # ok, crappy design.
+ now = self.listbox.curselection()
+ #if now != self.currentSelec and now != ():
+ if now != ():
+ self.app.updateWidgets(self.scales[int(now[0])], current_scale)
+ self.currentSelec = now
+ self.after(250, self.poll)
+
+ def update(self, currentSelection):
+ # notify the parent class of the change
+ # in the list
+ return