1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| # -*- coding: utf-8 -*-
# Application gammique évolutive
# Version 1 : Calculer les gammes
# progam.py
from tkinter import *
class Gammique(Tk):
""" Ramification Gammique """
def __init__(self):
Tk.__init__(self)
"Tableau de bord"
self.title('Entité Gammique :')
# Fenêtre écran_résultat
self.can=Canvas(self,bg='ivory', height=500,width=750)
self.can.pack(side=RIGHT)
# Bouton gamme_audio
Button(self,text ='Radio').pack()
# Les notes cursives scalpha : Graduations gérées.
self.sca1=Scale(self,length =250,orient = HORIZONTAL,label ='C',
troughcolor ='black',sliderlength =20,showvalue =1,
from_ =0,to =5,tickinterval =1,command=self.scanote1)
self.sca1.pack()
self.sca2=Scale(self,length =250,orient = HORIZONTAL,label ='D',
troughcolor ='green',sliderlength =20,showvalue =1,
from_ =-1,to =4,tickinterval =1,command=self.scanote2)
self.sca2.pack()
self.sca3=Scale(self,length =250,orient = HORIZONTAL,label ='E',
troughcolor ='blue',sliderlength =20,showvalue =1,
from_ =-2,to =3,tickinterval =1,command=self.scanote3)
self.sca3.pack()
self.sca4=Scale(self,length =250,orient = HORIZONTAL,label ='F',
troughcolor ='grey',sliderlength =20,showvalue =1,
from_ =-2,to =3,tickinterval =1,command=self.scanote4)
self.sca4.pack()
self.sca5=Scale(self,length =250,orient = HORIZONTAL,label ='G',
troughcolor ='red',sliderlength =20,showvalue =1,
from_ =-3,to =2,tickinterval =1,command=self.scanote5)
self.sca5.pack()
self.sca6=Scale(self,length =250,orient = HORIZONTAL,label ='A',
troughcolor ='orange',sliderlength =20,showvalue =1,
from_ =-4,to =1,tickinterval =1,command=self.scanote6)
self.sca6.pack()
self.sca7=Scale(self,length =250,orient = HORIZONTAL,label ='B',
troughcolor ='yellow',sliderlength =20,showvalue =1,
from_ =-5,to =0,tickinterval =1,command=self.scanote7)
self.sca7.pack()
# Concerne les notes scahuit : Graduations gérées.
self.sca8=Scale(self,length =250,orient = HORIZONTAL,label ='CDEFGAB',
troughcolor ='white',sliderlength =20,showvalue =1,
from_ =-12,to =12,tickinterval =1,command=self.scanote8)
self.sca8.pack()
# Bouton gamme_naturelle
Button(self,text ='Zéro').pack()
# Texte significatif
lab=Label(self,text="Barre des tâches ").pack(side=RIGHT)
# Tableau réunissant les tables diatoniques
self.gammes =['1101110','0201110','2001110','4000010','1011110','0111110','1030010',
'1210010','2200010','0012110','1300010','0021110','1220000','0040010',
'1400000','1002110','0102110','1130000','0003110','1100210','0200210',
'0202010','2000210','1010210','1012010','1112000','2003000','0020210',
'1202000','1003010','1001210','1103000','1121000','0100310','0010310',
'0001310','0002210','1000310','0022010','0000410','0023000','1004000',
'0005000','1101020','1101200','0201020','0201200','2001020','2001200',
'1011020','1011200','1100120','1100300','1102100','1120100','0200030',
'1002200','1001030','1300100','1000130','0003020','0021200','1000040',
'0003200','1100030','3000020']
# Définition des curseurs
def scanote1(self,xc):
do=int(xc)
ysi=self.sca7.get()
yre=self.sca2.get()
if do<ysi:self.sca7.set(do)
if do>yre+1 :self.sca2.set(do-1)
def scanote2(self,xd):
re=int(xd)
ydo=self.sca1.get()
ymi=self.sca3.get()
if re<ydo-1:self.sca1.set(re+1)
if re>ymi+1 :self.sca3.set(re-1)
def scanote3(self,xe):
mi=int(xe)
yre=self.sca2.get()
yfa=self.sca4.get()
if mi<yre-1:self.sca2.set(mi+1)
if mi>yfa:self.sca4.set(mi)
def scanote4(self,xf):
fa=int(xf)
ymi=self.sca3.get()
ysol=self.sca5.get()
if fa<ymi:self.sca3.set(fa)
if fa>ysol+1:self.sca5.set(fa-1)
def scanote5(self,xg):
sol=int(xg)
yfa=self.sca4.get()
yla=self.sca6.get()
if sol<yfa-1:self.sca4.set(sol+1)
if sol>yla+1:self.sca6.set(sol-1)
def scanote6(self,xa):
la=int(xa)
ysol=self.sca5.get()
ysi=self.sca7.get()
if la<ysol-1:self.sca5.set(la+1)
if la>ysi+1:self.sca7.set(la-1)
def scanote7(self,xb):
si=int(xb)
yla=self.sca6.get()
ydo=self.sca1.get()
if si<yla-1:self.sca6.set(si+1)
if si>ydo:self.sca1.set(si)
def scanote8(self,xh):
sch=xh
Gammique().mainloop() |