key Bezeichner in dict ändern
Verfasst: Dienstag 1. August 2023, 16:31
Ich bin ganz stolz, dass ich Aufgaben zur Bruchrechnung auch mit Grafiken anzeigen kann.
Das bekomme ich aber nicht hin:
Ich benötige mehrmals Kreissegmente mit verschiedenen Winkeln und konnte mir da bisher nur helfen, indem ich mehrere Funktionen erstellt habe:
Wie ihr seht ändern sich nur die Key Bezeichner. Ich würde gerne eine Zahl an die Funktion übergeben, die dann jeweils an das x oder y angehängt wird. Geht das?
Das bekomme ich aber nicht hin:
Ich benötige mehrmals Kreissegmente mit verschiedenen Winkeln und konnte mir da bisher nur helfen, indem ich mehrere Funktionen erstellt habe:
Code: Alles auswählen
def bruch2(center_x, center_y, radius, nenner):
startwinkel = 90
winkel = 360/nenner
rad_start = math.radians(startwinkel)
rad = math.radians(winkel)
start_x = center_x - radius * math.cos(rad_start)
start_y = center_y - radius * math.sin(rad_start)
end_x = center_x - radius * math.cos(rad+rad_start)
end_y = center_y - radius * math.sin(rad+rad_start)
if winkel <=180:
largeArcFlag = 0
else:
largeArcFlag = 1
koordinaten = dict(
start_x2 = start_x, start_y2 = start_y, end_x2 = end_x, end_y2 = end_y,
largeArcFlag2 = largeArcFlag)
return koordinaten
def hauptnenner(center_x, center_y, radius, nenner):
startwinkel = 90
winkel = 360/nenner
rad_start = math.radians(startwinkel)
rad = math.radians(winkel)
start_x = center_x - radius * math.cos(rad_start)
start_y = center_y - radius * math.sin(rad_start)
end_x = center_x - radius * math.cos(rad+rad_start)
end_y = center_y - radius * math.sin(rad+rad_start)
if winkel <=180:
largeArcFlag = 0
else:
largeArcFlag = 1
koordinaten = dict(
start_x3 = start_x, start_y3 = start_y, end_x3 = end_x, end_y3 = end_y,
largeArcFlag3 = largeArcFlag)
return koordinaten