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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
def tetra(self):
self.ttt = Toplevel(self)
self.ttt.title('Entité Gammique : Tétracorde')
self.ttt.geometry('600x666')
fonttt = Font(size=6)
frtet = Frame(self.ttt,width=30,height=1,bg='green')
frtet.pack(side=RIGHT)
bttet1 = Button(frtet,text ='Tétras',height=1, width=10,bg ='orange', command= lambda: ttractuac(1))
bttet1.pack()
bttet2 = Button(frtet,text ='Utiles',height=1, width=10,bg ='orange', command= lambda: ttractuac(2))
bttet2.pack()
bttet3 = Button(frtet,text ='Clones',height=1, width=10,bg ='orange', command= lambda: ttractuac(3))
bttet3.pack()
frtet_sup = Frame(self.ttt,width=15,height=1)
frtet_sup.pack(side=RIGHT)
bttet_sup1 = Button(frtet_sup,text ='Sup',height=1, width=10,bg ='lightgrey').pack()
frtet_inf = Frame(self.ttt,width=15,height=1)
frtet_inf.pack(side=RIGHT)
bttet_inf1 = Button(frtet_inf,text ='Inf',height=1, width=10,bg ='lightgrey').pack()
frtet_ = Frame(self.ttt,width=30,height=1)
frtet_.pack(side=BOTTOM)
bttet_ = Button(frtet_,text ='Quitter',height=1, width=15,bg ='lightgrey', command= self.ttt.destroy)
bttet_.pack()
tetcan = Canvas(self.ttt,bg='ivory', height=500,width=300)
tetcan.place(x=30,y=30, anchor='nw')
tetcan.create_line(50, 30, 250, 30, fill ='blue')
txlgh = 50 ; txldh = 250 ; tylgh = tyldh = 60 # Axe horizontal
tylgv = 50 ; tyldv = 460 ; txlgv = txldv = 30 # Axe vertical
for i in range(66):
tetcan.create_line(txlgh, tylgh+i*6, txldh, tyldh+i*6, fill ='lightgrey')
for i in range(13):
tetcan.create_line(txlgv+i*20, tylgv, txldv+i*20, tyldv, fill ='lightgrey')
# Le pas : (horizontal = *20)(vertical = *6)
r1 = 3 ; x1 = 150 ; y1 = 15
tetcan.create_oval(x1-r1,y1-r1,x1+r1,y1+r1,fill='white')
r2 = 2 ; x2 = 150 ; y2 = 24
tetcan.create_oval(x2-r2,y2-r2,x2+r2,y2+r2,fill='white')
lbtet = Label(self.ttt, text ="Tétra's", font ='bold',fg = 'blue').pack()
tetcan.create_text(66,15,text='Système tétracordique',fill='black')
def ttractuac(t):
tetcan.delete(ALL)
tetcan.create_line(50, 30, 250, 30, fill ='blue')
for i in range(66):
tetcan.create_line(txlgh, tylgh+i*6, txldh, tyldh+i*6, fill ='lightgrey')
for i in range(13):
tetcan.create_line(txlgv+i*20, tylgv, txldv+i*20, tyldv, fill ='lightgrey')
xh= 30; yh= 60 # Départ Axe horizontal
if t == 0 : pass
elif t == 1 : # Bouton tétras (tgam_tet = [])
# xh= 30; yh= 60 # Départ Axe horizontal(x)/vertical(y)
tetcan.create_text(150,15,text='Système tétracordique ordonné',fill='grey')
tv = 0
for tt in tgam_tet:
th = td = 0
tt_inf = tt[0]
tt_sup = tt[1]
td = 13 - (len(tt_inf + tt_sup))
for tti in tt_inf:
if tti == 1:
tetcan.create_oval(xh+th*20-r1,yh+tv*6-r1,xh+th*20+r1,yh+tv*6+r1,fill='red')
th += 1
else:
tetcan.create_oval(xh+th*20-r2,yh+tv*6-r2,xh+th*20+r2,yh+tv*6+r2,fill='yellow')
th += 1
if td > 0:
th1 = th
for td_ in range(td):
tetcan.create_oval(xh+th1*20-r1,yh+tv*6-r1,xh+th1*20+r1,yh+tv*6+r1,fill='white')
th1 += 1
th = th1
td = 0
for tts in tt_sup:
if tts == 1:
tetcan.create_oval(xh+th*20-r1,yh+tv*6-r1,xh+th*20+r1,yh+tv*6+r1,fill='blue')
th += 1
else:
tetcan.create_oval(xh+th*20-r2,yh+tv*6-r2,xh+th*20+r2,yh+tv*6+r2,fill='yellow')
th += 1
tv += 1
elif t == 2 : # Bouton utiles (tet_is:inf/sup/nom,tet_tt:ordre,tgam_util:clone)
# xh= 30; yh= 60 # Départ Axe horizontal(x)/vertical(y)
tetcan.create_text(150,15,text='Système tétracordique utilisé',fill='grey')
tu = x_01i = x_01s = 0 # x_01:Jeux de marges du texte
for tt in tgam_util: # :clone(tt)=[1, 1, 1, 1]
t_is = tet_is[tu] # :"inf/sup"/nom(tu):"L'horizontale(x)":=('Inf', '0')
t_tt = tet_tt[tu] # :ordre(tu):La verticale(y):=zéro à 66
t_ut = tt
th = 0
tis0i = tis0s = 0 # Compteurs des tétras(inf/sup)
if t_is[0] == 'Inf':
tis0i += 1
if x_01i == 1:
x10 = 7 # Marges de principe(x)
x_01i = 0
else:
x10 = 17 # Marges de principe(x)
x_01i = 1
for t in t_ut:
if t == 1:
tetcan.create_oval(xh+th*20-r1,yh+t_tt*6-r1,xh+th*20+r1,yh+t_tt*6+r1,fill='red')
else:
tetcan.create_oval(xh+th*20-r2,yh+t_tt*6-r2,xh+th*20+r2,yh+t_tt*6+r2,fill='yellow')
th += 1
tetcan.create_text(x10,yh+t_tt*6,text=t_is[1],font=fonttt,fill='red')
Button(frtet_inf,text =t_is[1],height=1, width=5,bg ='pink').pack()
elif t_is[0] == 'Sup':
tis0s += 1
if x_01s == 1:
x290 = 284 # Marges de principe(x)
x_01s = 0
else:
x290 = 292 # Marges de principe(x)
x_01s = 1
t_len = 13 - len(tt)
th += t_len
for t in t_ut:
if t == 1:
tetcan.create_oval(xh+th*20-r1,yh+t_tt*6-r1,xh+th*20+r1,yh+t_tt*6+r1,fill='blue')
else:
tetcan.create_oval(xh+th*20-r2,yh+t_tt*6-r2,xh+th*20+r2,yh+t_tt*6+r2,fill='yellow')
th += 1
tetcan.create_text(x290,yh+t_tt*6,text=t_is[1],font=fonttt,fill='blue')
Button(frtet_sup,text =t_is[1],height=1, width=5,bg ='lightblue').pack()
tu += 1
elif t == 3 : # Bouton clones (ts_simil = [])
# xh= 30; yh= 60 # Départ Axe horizontal(x)/vertical(y)
tetcan.create_text(150,15,text='Système tétracordique cloné',fill='grey')
print(t)
# La gamme en cours comme élément - système de définition tétracordique
# Développé tétra similaire diatonique: TETRA/CLONE/DIATONE
# self.gamnomscopie[]:(noms[+2])gammes - signatures(int)
# self.gammescopie[] :(valeurs[1,1,0,,,])gammes - intervalles(int)
# self.accdiese[(de 0 à +6)]: Table des altérations/str(+)
# self.accbemol[(de -1 à -6)]: Table des altérations/str(-)
# self.sel_myx[0] : Est l'indice [i] en cours, dans self.gamnomscopie[i]
# La transition modifie [1,1,0,1,1,1,0] en ([1,0,1,0,1,1],[1,0,1,0,1,1])
tginf_tra = [] ; tgsup_tra = [] # Tables transitives (inf/sup)
tgam_tet = [] # tgam_tet : Table tétra's complète
tg_tra = [0] # tg_tra[0]: Table tétra en cours
ts_simil = [] # Table des similaires
tgam_util = [] # Tables des utilités
tginf_nbr = tgsup_nbr = 0
t_gam = self.gammescopie[self.sel_myx[0]]
tgam_inf = t_gam[:4]
tgam_sup = t_gam[4:]
for tg_i in tgam_inf:
if tg_i > 0:
for tg_ii in range(tg_i+1):
if tg_ii == 0 :
tginf_tra.append(1)
tginf_nbr +=1
elif tginf_nbr < 4:
tginf_tra.append(0)
else:
tginf_tra.append(1)
tginf_nbr +=1
for tg_s in tgam_sup:
if tg_s > 0:
for tg_ss in range(tg_s+1):
if tg_ss == 0 :
tgsup_tra.append(1)
tgsup_nbr +=1
elif tgsup_nbr < 4:
tgsup_tra.append(0)
if tgsup_nbr == 4:
tgsup_tra.append(1)
tgsup_nbr +=1
if tg_s == 0:
tgsup_tra.append(1)
tgsup_nbr +=1
tgsup_tra.append(1)
tgsup_nbr +=1
tg_tra[0] = tginf_tra, tgsup_tra
# Bouton tétras : L'ensemble tétracordique
t = 0
for t_ in self.gammescopie:
tinf_tra = [] ; tsup_tra = []
tinf_nbr = tsup_nbr = 0
t_tra = [0]
t +=1
t_inf = t_[:4]
t_sup = t_[4:]
for t_i in t_inf:
if t_i > 0:
for t_ii in range(t_i+1):
if t_ii == 0 :
tinf_tra.append(1)
tinf_nbr +=1
elif tinf_nbr < 4:
tinf_tra.append(0)
else:
tinf_tra.append(1)
tinf_nbr +=1
for t_s in t_sup:
if t_s > 0:
for t_ss in range(t_s+1):
if t_ss == 0 :
tsup_tra.append(1)
tsup_nbr +=1
elif tsup_nbr < 4:
tsup_tra.append(0)
if tsup_nbr == 4:
tsup_tra.append(1)
tsup_nbr +=1
if t_s == 0:
tsup_tra.append(1)
tsup_nbr +=1
tsup_tra.append(1)
tsup_nbr +=1
t_tra[0] = tinf_tra, tsup_tra
tgam_tet.append(t_tra[0]) # tgam_tet : Table tétra's complète
# Bouton clones : Les clones dans le système
tin_f = tg_tra[0][0]
tsu_p = tg_tra[0][1]
ts = ts_t = 0 # ts = Quantité de similitudes
for t_ in tgam_tet:
ts_eti = t_[0]
ts_ets = t_[1]
if tin_f == ts_eti:
tin_nom = 'Inf','Inf',self.gamnomscopie[ts_t]
ts_simil.append(tin_nom)
ts += 1
if tin_f == ts_ets:
tin_nom = 'Inf','Sup',self.gamnomscopie[ts_t]
ts_simil.append(tin_nom)
ts += 1
if tsu_p == ts_ets:
tin_nom = 'Sup','Sup',self.gamnomscopie[ts_t]
ts_simil.append(tin_nom)
ts += 1
if tsu_p == ts_eti:
tin_nom = 'Sup','Inf',self.gamnomscopie[ts_t]
ts_simil.append(tin_nom)
ts += 1
ts_t += 1
#(ts,ts_simil)
# Bouton utiles : Sans les clones de l'ensemble tétracordique
tet_is = [] ; tet_tt = []
t = t_t = 0
for t_ in tgam_tet:
ti_egal = ts_egal = 0
if t == 0:
ti_nom = 'Inf',self.gamnomscopie[t_t]
tet_is.append(ti_nom)
tet_tt.append(t_t)
tet_i = t_[0]
tgam_util.append(tet_i)
t += 1
tet_s = t_[1]
if tet_i != tet_s:
ts_nom = 'Sup',self.gamnomscopie[t_t]
tet_is.append(ts_nom)
tet_tt.append(t_t)
tgam_util.append(tet_s)
t += 1
else:
tet_i = t_[0]
tet_s = t_[1]
for t_u in tgam_util:
if t_u == tet_i:
ti_egal = 1
if t_u == tet_s:
ts_egal = 1
if ti_egal == 0:
ti_nom = 'Inf',self.gamnomscopie[t_t]
tet_is.append(ti_nom)
tet_tt.append(t_t)
tgam_util.append(tet_i)
t += 1
if ts_egal == 0:
ts_nom = 'Sup',self.gamnomscopie[t_t]
tet_is.append(ts_nom)
tet_tt.append(t_t)
tgam_util.append(tet_s)
t += 1
t_t += 1
#(t,tet_is,tet_tt,tgam_util)
t = 0
print('*') |
Partager