kleinere Anpassungen

This commit is contained in:
Mika 2023-11-01 15:29:24 +01:00
parent 828936269f
commit 978a85713d

View File

@ -4,7 +4,7 @@ import math
class Circle: class Circle:
def __init__(self, name: str, filepath: str, length=1234, height=1234, radius=10, distance=60, offset=50): def __init__(self, name: str, filepath: str, length=1000, height=1000, radius=10, distance=60, offset=50):
# run validations # run validations
assert length >= 0, "length can not be negative" assert length >= 0, "length can not be negative"
assert radius >= 0, "radius can not be negative" assert radius >= 0, "radius can not be negative"
@ -17,6 +17,7 @@ class Circle:
self.__height = height self.__height = height
self.__radius = radius self.__radius = radius
self.__distance = distance self.__distance = distance
self.__offset_percentage = offset
self.__offset = (distance / 100) * offset self.__offset = (distance / 100) * offset
self.__name = name self.__name = name
self.__filepath = filepath self.__filepath = filepath
@ -52,6 +53,10 @@ class Circle:
def distance(self, val): def distance(self, val):
self.__distance = val self.__distance = val
@property
def offset_percentage(self):
return self.__offset_percentage
@property @property
def offset(self): def offset(self):
return self.__offset return self.__offset
@ -90,14 +95,14 @@ if __name__ == '__main__':
if path == "0": if path == "0":
path = os.getcwd() path = os.getcwd()
shape = int(input("Form (1: Kreis, 2: Hexagon, 3: Dreieck)")) shape = int(input("Form (1: Kreis, 2: Hexagon, 3: Dreieck):"))
if shape == 1: if shape == 1:
circle = Circle(name, path) circle = Circle(name, path)
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 selection_flag = True
while selection_flag: while selection_flag:
parameter_selection = int(input("Parameter wählen (0: keinen Parameter ändern, 1: Höhe, 2: Länge, 3: Radius, 4: Abstand, 5: Offste):")) 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: if parameter_selection == 0:
selection_flag = False selection_flag = False
elif parameter_selection == 1: elif parameter_selection == 1: