Ich habe die Liste display (das sind keine booleans sondern tkinter-IntVars die die werte 150 oder 335 annehmen)
Code: Alles auswählen
clm0=[0, 0, 0, 0, 0, 0, 0, 0]
clm1=[0, 0, 0, 0, 0, 0, 0, 0]
clm2=[0, 0, 0, 0, 0, 0, 0, 0]
clm3=[0, 0, 0, 0, 0, 0, 0, 0]
clm4=[0, 0, 0, 0, 0, 0, 0, 0]
clm5=[0, 0, 0, 0, 0, 0, 0, 0]
clm6=[0, 0, 0, 0, 0, 0, 0, 0]
clm7=[0, 0, 0, 0, 0, 0, 0, 0]
display=[clm0, clm1, clm2, clm3, clm4, clm5, clm6, clm7]
display währe entsprechend:[[0 ,2][1][3 ,4 ,5][6][7]]
Code: Alles auswählen
clm0=[0, 0, 0, 0, 0, 0, 0, 0]
clm1=[0, 0, 0, 0, 1, 0, 0, 0]
clm2=[0, 0, 0, 0, 0, 0, 0, 0]
clm3=[0, 0, 1, 0, 0, 1, 0, 0]
clm4=[0, 0, 1, 0, 0, 1, 0, 0]
clm5=[0, 0, 1, 0, 0, 1, 0, 0]
clm6=[1, 1, 1, 1, 1, 1, 1, 1]
clm7=[0, 1, 0, 1, 0, 1, 0, 1]
Code: Alles auswählen
def preprocessing():
global display
global display_new
display_new=[]
display_copy=display
countclm=0
print("preprocessing")
print(len(display))
while countclm<len(display):
clm_new=[]
clm_storage=display[countclm]
while True:
try:
print("preprocessing")
clm_new.append(display_copy.index(clm_storage, countclm))
print(clm_new)
display_copy[display_copy.index(clm_storage, countclm)].append(countclm)
except:
display_new.append(clm_new)
break
countclm=countclm+1
print(display_new)
wenn ich dieses Programm jetzt allerdings ausführe stürzt es ab (ich nutze einen Raspi, aber ich denke nicht das es daran liegt). Wenn ich es mit den Taskmanager beende, steht unten das clm_new etwa so aussieht: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]. Allerdings sollte doch jedes mal countclm ans Ende der "clm" hinzugefügt werden, so das sie nicht mehr identisch zu clm_storage ist. Versuche ich da Äpfel mit Birnen zu vergleichen oder was mache ich falsch?