Error handling hinzugefügt
This commit is contained in:
parent
5b2b84dbf0
commit
e81f83c294
|
@ -5,7 +5,6 @@ import math
|
|||
|
||||
class Circle:
|
||||
def __init__(self, name: str, filepath: str, length=1000, height=1000, radius=10, distance=60, offset=50):
|
||||
# run validations
|
||||
assert length >= 0, "length can not be negative"
|
||||
assert height >= 0, "height can not be negative"
|
||||
assert radius >= 0, "radius can not be negative"
|
||||
|
@ -13,7 +12,6 @@ class Circle:
|
|||
assert offset >= 0, "offset can only be 0 - 100 %"
|
||||
assert offset <= 100, "offset can only be 0 - 100 %"
|
||||
|
||||
# Assign to self object
|
||||
self.__length = length
|
||||
self.__height = height
|
||||
self.__radius = radius
|
||||
|
@ -108,6 +106,7 @@ if __name__ == '__main__':
|
|||
print(f"\nStandardwerte\nHöhe: {circle.height} px\nLänge: {circle.length} px\nRadius: {circle.radius} px\nAbstand: {circle.distance} px\nOffset: {circle.offset_percentage} %\n")
|
||||
selection_flag = True
|
||||
while selection_flag:
|
||||
try:
|
||||
parameter_selection = int(input("Parameter ändern (0: keinen Parameter ändern, 1: Höhe, 2: Länge, 3: Radius, 4: Abstand, 5: Offste):"))
|
||||
if parameter_selection == 0:
|
||||
selection_flag = False
|
||||
|
@ -128,6 +127,10 @@ if __name__ == '__main__':
|
|||
circle.offset = offset
|
||||
else:
|
||||
print("ungültiger Wert")
|
||||
except ValueError:
|
||||
print("ungültiger Wert")
|
||||
except AssertionError as error:
|
||||
print(error)
|
||||
|
||||
circle.circle_generation()
|
||||
elif shape == 2:
|
||||
|
|
Loading…
Reference in New Issue