def main(): rectangle = Rectangle(center_x=0.0, center_y=0.0, width=10.0, height=5.0) rectangle.draw() circle = Circle(x=0.0, y=0.0, radius=7.0) circle.draw() color = input("Enter the color to fill: 'red' or 'blue': ") if color.lower() == 'red': color_impl = RedImplementor.get_instance() elif color.lower() == 'blue': color_impl = BlueImplementor.get_instance() else: return rectangle.set_color_implementor(color_impl) rectangle.fill_color() circle.set_color_implementor(color_impl) circle.fill_color()
r = int(input("How mach red do you want? (0,255) ")) g = int(input("How mach green do you want? (0,255) ")) b = int(input("How mach blue do you want? (0,255) ")) color = [r, g, b] shape = Rectangle(x, y, shape_width, shape_height, color) elif shape == 'square': x = int(input('What coordinate of x it have? ')) y = int(input('What coordinate of y it have? ')) shape_width = int(input("What length of side will have the square? ")) print('We create a color of the square. rgb') r = int(input("How mach red do you want? (0,255) ")) g = int(input("How mach green do you want? (0,255) ")) b = int(input("How mach blue do you want? (0,255) ")) color = [r, g, b] shape = Square(x, y, shape_width, color) # create a img with shapes canvas = Canvas(width, height, color_of_canvas) # draw the shape on canvas shape.draw(canvas) # create file cli_image.png with canvas and shapes on them canvas.make('files/cli_image.png') answer = input('Do you wont to create another figure? y/n: ') if answer.lower() == 'n': print('Bye') break