def on_draw(self): #circle arcade.start_render() arcade.draw_circle_filled(240, 360, 30, arcade.color.BLUE) arcade.draw_circle_outline(340, 360, 30, arcade.color.BUFF) #ellipse arcade.draw_ellipse_filled(100, 100, 50, 80, arcade.color.AQUA) arcade.draw_ellipse_outline(200, 100, 50, 80, arcade.color.AMETHYST) #rectangle arcade.draw_rectangle_filled(300, 100, 50, 50, arcade.color.RASPBERRY_GLACE) arcade.draw_rectangle_outline(400, 100, 50, 100, arcade.color.YANKEES_BLUE, 4) #text-szöveg arcade.draw_text("Kóder Klub", 20, 720 - 80, arcade.color.ALMOND, 24) #arc-iv arcade.draw_arc_filled(640, 720 - 80, 120, 120, arcade.color.YELLOW_GREEN, 0, 90) arcade.draw_arc_filled(1040, 720 - 80, 120, 120, arcade.color.GLITTER, 0, 180) #triangle arcade.draw_polygon_outline([[0, 0], [50, 0], [25, 50]], arcade.color.RAZZMIC_BERRY) #polygon arcade.draw_polygon_outline( [[640, 360], [640 + 50, 360], [640 + 75, 360 + 25], [640 + 25, 360 + 50], [640 - 25, 360 + 25]], arcade.color.EARTH_YELLOW)
def draw_toolbar_shapes(): # Export button arcade.draw_text("EXPORT", 15, 765, arcade.color.BLACK, font_size=18) # Draw rectangles arcade.draw_rectangle_filled(25, 725, 35, 15, arcade.color.BLUE) arcade.draw_rectangle_outline(75, 725, 35, 15, arcade.color.BLUE) # Draw circles arcade.draw_circle_filled(25, 675, 13, arcade.color.BLUE) arcade.draw_circle_outline(75, 675, 13, arcade.color.BLUE) # Draw ellipses arcade.draw_ellipse_filled(25, 625, 18, 8, arcade.color.BLUE) arcade.draw_ellipse_outline(75, 625, 18, 8, arcade.color.BLUE) # Draw triangles arcade.draw_triangle_filled(25, 590, 10, 560, 40, 560, arcade.color.BLUE) arcade.draw_triangle_outline(75, 590, 60, 560, 90, 560, arcade.color.BLUE) # Draw arc tops (to symbolize arc tops & bottoms) arcade.draw_arc_filled(25, 520, 15, 15, arcade.color.BLUE, 0, 180) arcade.draw_arc_outline(75, 520, 15, 15, arcade.color.BLUE, 0, 180) # Draw lines arcade.draw_line(10, 460, 40, 490, arcade.color.BLUE, line_width=2) arcade.draw_line(60, 460, 90, 490, arcade.color.BLUE, line_width=1)
def on_draw(self): arcade.start_render() # Circle - Kör arcade.draw_circle_filled(240, 360, 30, arcade.color.BLUE) arcade.draw_circle_outline(340, 360, 30, arcade.color.BUFF) # Ellipse - Ellipszis arcade.draw_ellipse_filled(100, 100, 50, 80, arcade.color.AO) arcade.draw_ellipse_outline(200, 100, 50, 80, arcade.color.YELLOW) # Rectangle - Téglalap arcade.draw_rectangle_filled(300, 100, 50, 50, arcade.color.ALIZARIN_CRIMSON) arcade.draw_rectangle_outline(400, 100, 50, 150, arcade.color.YANKEES_BLUE, 4) # Text - Szöveg arcade.draw_text("Kóder Klub", 20, 720 - 80, arcade.color.AQUA, 24) # Arc - Ív arcade.draw_arc_filled(640, 720 - 80, 120, 120, arcade.color.YELLOW_ORANGE, 0, 90) arcade.draw_arc_filled(1040, 720 - 80, 120, 120, arcade.color.YELLOW_ORANGE, 0, 270) # Triangle - Háromszög arcade.draw_polygon_outline([[0, 0], [50, 0], [25, 50]], arcade.color.AFRICAN_VIOLET) # Pentagon - Ötszög arcade.draw_polygon_outline( [[640, 360], [640 + 50, 360], [640 + 75, 360 + 25], [640 + 25, 360 + 50], [640 - 25, 360 + 25]], arcade.color.ALLOY_ORANGE)
def draw_binary( self ): # Function which draws the center 2 stars, if there is a binary system present. x_s1 = -data.star_barycenter_1 * self.scale * math.sin( self.tick * self.bin_mod_tick + self.rand_bin_add) y_s1 = (data.star_barycenter_1 * self.scale) / 2 * math.cos(self.tick * self.bin_mod_tick + self.rand_bin_add) x_s2 = data.star_barycenter_2 * self.scale * math.sin( self.tick * self.bin_mod_tick + self.rand_bin_add) y_s2 = (-data.star_barycenter_2 * self.scale) / 2 * math.cos(self.tick * self.bin_mod_tick + self.rand_bin_add) arcade.draw_ellipse_outline(CENTER_X, CENTER_Y, data.star_barycenter_1 * self.scale, data.star_barycenter_1 * self.scale / 2, (60, 60, 60)) arcade.draw_ellipse_outline(CENTER_X, CENTER_Y, data.star_barycenter_2 * self.scale, data.star_barycenter_2 * self.scale / 2, (60, 60, 60)) arcade.draw_line(CENTER_X + x_s1, CENTER_Y + y_s1, CENTER_X + x_s2, CENTER_Y + y_s2, (100, 100, 100), 1) arcade.draw_circle_filled(CENTER_X + x_s1, CENTER_Y + y_s1, data.star_radius_1 * self.scale + 2, self.star_colour1) arcade.draw_circle_filled(CENTER_X + x_s2, CENTER_Y + y_s2, data.star_radius_2 * self.scale + 2, self.star_colour2)
def draw_circle_outline(self, latlon, radius, color=(128, 128, 128), width=1): x, y = self.map.project(latlon) rx, ry = self.map.project_radius(latlon, radius) arcade.draw_ellipse_outline(x, y, rx, ry, color, width)
def on_draw(self): arcade.start_render() arcade.draw_ellipse_filled(self.circle_x, self.circle_y, 80, 80, arcade.color.AO) arcade.draw_ellipse_outline(self.circle_x, self.circle_y, 80, 80, arcade.color.YELLOW_ROSE) arcade.draw_text(f"x:{self.circle_x:.0f} - y:{self.circle_y:.0f}", 10, 720 - 20, arcade.color.WHITE, 16)
def on_draw(self): """ Render the screen. """ # Start the render process. This must be done before any drawing commands. arcade.start_render() radius = 50 width = radius * 2 x = 200 y = 100 arcade.draw_rectangle_outline(x, y, width, width, arcade.color.BLACK, 2) arcade.draw_circle_outline(x, y, radius, arcade.color.BLACK, 2) arcade.draw_line(x - radius, y, x + radius, y, arcade.color.BLACK, 2) x = 200 y = 300 width = 150 half_width = width / 2 arcade.draw_rectangle_outline(x, y, width, 50, arcade.color.BLACK, 2) arcade.draw_ellipse_outline(x, y, width, 50, arcade.color.AFRICAN_VIOLET, 2) arcade.draw_line(x - half_width, y, x + half_width, y, arcade.color.RED, 2) radius = 50 width = radius * 2 x = 400 y = 100 arcade.draw_rectangle_outline(x, y, width, width, arcade.color.BLACK, 2) arcade.draw_circle_filled(x, y, radius, arcade.color.AFRICAN_VIOLET) arcade.draw_line(x - radius, y, x + radius, y, arcade.color.BLACK, 2) x = 400 y = 300 width = 150 half_width = width / 2 arcade.draw_rectangle_outline(x, y, width, 50, arcade.color.BLACK, 2) arcade.draw_ellipse_filled(x, y, width, 50, arcade.color.AFRICAN_VIOLET, 2) arcade.draw_line(x - half_width, y, x + half_width, y, arcade.color.RED, 2) big = arcade.load_texture( ":resources:images/animated_characters/female_person/femalePerson_idle.png", scale=1) small = arcade.load_texture( ":resources:images/animated_characters/female_person/femalePerson_idle.png", scale=.5) assert big.width > small.width
def on_draw(self): """Called whenever we need to draw our window """ # Clear the screen and start drawing arcade.start_render() # Draw a blue arc arcade.draw_arc_filled(100, 100, 40, 40, arcade.color.BLUE, 0, 125) # Draw a red ellipse arcade.draw_ellipse_outline(300, 100, 60, 30, arcade.color.RED, border_width=2) # Draw some purple lines arcade.draw_line(500, 100, 550, 100, arcade.color.PURPLE) arcade.draw_line(500, 90, 550, 90, arcade.color.PURPLE, line_width=2) arcade.draw_line(500, 80, 550, 80, arcade.color.PURPLE, line_width=3) # Draw an orange parabola arcade.draw_parabola_filled(100, 100, 130, 120, arcade.color.ORANGE) # Draw a black point arcade.draw_point(300, 300, arcade.color.BLACK, 20) # Draw a green polygon points_list = [ [500, 300], [550, 300], [575, 325], [550, 350], [525, 340], ] arcade.draw_polygon_outline(points_list, arcade.color.GREEN, line_width=5) # Draw some rectangles arcade.draw_rectangle_filled(100, 500, 150, 75, arcade.color.AZURE) arcade.draw_lrtb_rectangle_filled(150, 250, 575, 525, arcade.color.AMARANTH_PINK) arcade.draw_xywh_rectangle_filled(200, 550, 150, 75, arcade.color.ASPARAGUS) # Draw some triangles arcade.draw_triangle_filled(400, 500, 500, 500, 450, 575, arcade.color.DEEP_RUBY)
def draw_face(x, y): #Face arcade.draw_ellipse_filled(x, y, 125, 150, arcade.color.YELLOW_ROSE) arcade.draw_ellipse_outline(x, y, 125, 150, arcade.color.BRONZE_YELLOW, 2) #Eye arcade.draw_circle_filled(x - 50, y + 40, 25, arcade.color.WHITE) arcade.draw_ellipse_filled(x - 50, y + 30, 15, 15, arcade.color.PEARL_AQUA) arcade.draw_circle_filled(x + 50, y + 40, 25, arcade.color.WHITE) arcade.draw_ellipse_filled(x + 50, y + 30, 15, 15, arcade.color.PEARL_AQUA) #Mouth arcade.draw_ellipse_filled(x, y - 50, 25, 30, arcade.color.BLACK_BEAN)
def draw_fishr(x, y, color): # Fish facing right # Body arcade.draw_ellipse_filled(x + 70, y + 15, 85, 35, color, 0, 50) arcade.draw_ellipse_outline(x + 70, y + 15, 85, 35, arcade.color.BLACK, 2, 0, 50) # Tail arcade.draw_triangle_filled(x, y - 5, x + 28, y + 15, x, y + 35, color) arcade.draw_triangle_outline(x, y - 5, x + 28, y + 15, x, y + 35, arcade.color.BLACK, 2) # Eyes and mouth arcade.draw_circle_filled(x + 94, y + 20, 5, arcade.color.WHITE_SMOKE, 50) arcade.draw_circle_filled(x + 96, y + 20, 3, arcade.color.BLACK, 50) arcade.draw_line(x + 98, y + 10, x + 110, y + 10, arcade.color.BLACK, 1)
def draw_exoplanet(self, a, b, c): # Function that draws the exoplanet. arcade.draw_ellipse_outline(CENTER_X, CENTER_Y, (data.p_star_distance * self.scale), ((data.p_star_distance * self.scale) // 2), (200, 200, 200), 1, 0) arcade.draw_line(self.planet_x, self.planet_y, CENTER_X, CENTER_Y, (0, 100, 0)) arcade.draw_circle_filled(a, b, c, data.p_colour) arcade.draw_rectangle_outline(a, b, 64, 32, (255, 0, 255), 1) arcade.draw_line(a - 32, b - 16, CENTER_X_MAGNIFIED - (MAGNIFIED_LENGTH / 2), CENTER_Y_MAGNIFIED + (MAGNIFIED_HEIGHT / 2), (255, 0, 255)) arcade.draw_line(a + 32, b - 16, CENTER_X_MAGNIFIED + (MAGNIFIED_LENGTH / 2), CENTER_Y_MAGNIFIED + (MAGNIFIED_HEIGHT / 2), (255, 0, 255))
def draw_nose_cone(position_x, position_y): arcade.draw_ellipse_filled(position_x + 105, position_y - 3, WIDTH + 25, HEIGHT_1 - 5, (224, 188, 40)) arcade.draw_ellipse_outline(position_x + 105, position_y - 3, WIDTH + 25, HEIGHT_1 - 5, (121, 123, 128), 2) point_list_1 = ((position_x, position_y), (position_x + 35, position_y + 45), (position_x + 185, position_y + 45), (position_x + 215, position_y)) arcade.draw_polygon_filled(point_list_1, (203, 214, 214)) arcade.draw_polygon_outline(point_list_1, (121, 123, 128), 4) arcade.draw_arc_filled(position_x + 112, position_y + 92, WIDTH_1, HEIGHT_1, (203, 214, 214), START_ANGLE, END_ANGLE) arcade.draw_arc_outline(position_x + 112, position_y + 92, WIDTH_1, HEIGHT_1, (121, 123, 128), START_ANGLE, END_ANGLE, 4)
def on_draw(self): """ Render the screen. """ # Start the render process. This must be done before any drawing commands. arcade.start_render() radius = 50 width = radius * 2 x = 200 y = 100 arcade.draw_rectangle_outline(x, y, width, width, arcade.color.BLACK, 2) arcade.draw_circle_outline(x, y, radius, arcade.color.BLACK, 2) arcade.draw_line(x - radius, y, x + radius, y, arcade.color.BLACK, 2) x = 200 y = 300 width = 150 half_width = width / 2 arcade.draw_rectangle_outline(x, y, width, 50, arcade.color.BLACK, 2) arcade.draw_ellipse_outline(x, y, width, 50, arcade.color.AFRICAN_VIOLET, 2) arcade.draw_line(x - half_width, y, x + half_width, y, arcade.color.RED, 2) radius = 50 width = radius * 2 x = 400 y = 100 arcade.draw_rectangle_outline(x, y, width, width, arcade.color.BLACK, 2) arcade.draw_circle_filled(x, y, radius, arcade.color.AFRICAN_VIOLET) arcade.draw_line(x - radius, y, x + radius, y, arcade.color.BLACK, 2) x = 400 y = 300 width = 150 half_width = width / 2 arcade.draw_rectangle_outline(x, y, width, 50, arcade.color.BLACK, 2) arcade.draw_ellipse_filled(x, y, width, 50, arcade.color.AFRICAN_VIOLET, 2) arcade.draw_line(x - half_width, y, x + half_width, y, arcade.color.RED, 2)
def draw_fishl(x, y, color): # Fish facing left # Body arcade.draw_ellipse_filled(x + 70, y + 15, 85, 35, color, 0, 50) arcade.draw_ellipse_outline(x + 70, y + 15, 85, 35, arcade.color.BLACK, 2, 0, 50) # Tail arcade.draw_triangle_filled(x + 170, y, x + 112, y + 15, x + 170, y + 40, color) arcade.draw_triangle_outline(x + 170, y, x + 112, y + 15, x + 170, y + 40, arcade.color.BLACK, 2) # Eyes and mouth arcade.draw_circle_filled(x + 38, y + 20, 5, arcade.color.WHITE_SMOKE, 50) arcade.draw_circle_filled(x + 36, y + 20, 3, arcade.color.BLACK, 50) arcade.draw_line(x + 30, y + 10, x + 45, y + 10, arcade.color.BLACK, 1)
def draw_bandera(x, y): #500 335 """ left_x, bottom_y """ arcade.draw_ellipse_filled(x, y - 285, x - 440, y - 305, arcade.color.LIGHT_GRAY) arcade.draw_ellipse_outline(x, y - 285, x - 440, y - 305, arcade.color.BLACK, 2) arcade.draw_lrtb_rectangle_outline(x - 5, x + 5, y + 165, y - 280, arcade.color.BLACK, 3) arcade.draw_lrtb_rectangle_filled(x - 4, x + 4, y + 164, y - 285, arcade.color.LIGHT_GRAY) arcade.draw_lrtb_rectangle_filled(x, x + 240, y + 160, y, arcade.color.RED) arcade.draw_lrtb_rectangle_outline(x, x + 240, y + 160, y, arcade.color.BLACK, 2) draw_star(x + 40, y + 110, 25, 10, arcade.color.YELLOW) draw_star(x + 75, y + 135, 10, 4, arcade.color.YELLOW, pi / 10) draw_star(x + 95, y + 120, 10, 4, arcade.color.YELLOW, -pi / 10) draw_star(x + 95, y + 95, 10, 4, arcade.color.YELLOW) draw_star(x + 75, y + 80, 10, 4, arcade.color.YELLOW, pi / 10)
def draw_exomoon(self, size, p_x, p_y, ampli, colour, i): # Function that draws the exomoon x = (-self.ampli_m * math.sin(self.tick * self.moon_tick_scale[i] + self.moon_start[i]) + self.planet_x) y = (self.ampli_m / 2 * math.cos(self.tick * self.moon_tick_scale[i] + self.moon_start[i]) + self.planet_y) magnified_x = ( self.ampli_m_m * math.cos(self.tick * self.moon_tick_scale[i] + self.moon_start[i]) + CENTER_X_MAGNIFIED) magnified_y = ( -self.ampli_m_m / 2 * math.sin(self.tick * self.moon_tick_scale[i] + self.moon_start[i]) + CENTER_Y_MAGNIFIED) arcade.draw_ellipse_outline(p_x, p_y, ampli, (ampli // 2), (50, 50, 50)) arcade.draw_circle_filled(x, y, size, colour) arcade.draw_circle_filled(magnified_x, magnified_y, size, colour)
def draw_koffing(x, y): # Draw KoffingBody arcade.draw_circle_filled(450, y, 85, arcade.color.PURPLE) # Draw KoffingEye1 arcade.draw_parabola_filled(410, 20 + y, 430, 15, arcade.color.WHITE) # Draw KoffingEye2 arcade.draw_parabola_filled(470, 20 + y, 490, 15, arcade.color.WHITE) # Draw KoffingEyeLine1 arcade.draw_parabola_outline(410, 20 + y, 430, 15, arcade.color.BLACK, 2) # Draw KoffingEyeLine2 arcade.draw_parabola_outline(470, 20 + y, 490, 15, arcade.color.BLACK, 2) # Draw KoffingPupil1 arcade.draw_circle_filled(420, 42 + y, 4, arcade.color.BLACK) # Draw KoffingPupil2 arcade.draw_circle_filled(480, 42 + y, 4, arcade.color.BLACK) # Draw KoffingMouth arcade.draw_parabola_filled(420, 50 + y, 480, -35, arcade.color.PINK) # Draw KoffingFang1 arcade.draw_triangle_filled(400, 15 + y, 420, y + 15, 410, y - 5, arcade.color.WHITE) # Draw KoffingFang2 arcade.draw_triangle_filled(480, 15 + y, 500, y + 15, 490, y - 5, arcade.color.WHITE) # Draw KoffingCircle arcade.draw_ellipse_outline(450, y - 40, 25, 15, arcade.color.WHITE, 5) # Draw KoffingX1 arcade.draw_line(440, y - 75, 460, y - 55, arcade.color.WHITE, 3) # Draw KoffingX2 arcade.draw_line(460, y - 75, 440, y - 55, arcade.color.WHITE, 3)
def on_draw(self): arcade.start_render() # zöld kör arcade.draw_ellipse_filled(self.green_circle_x, self.green_circle_y, 80, 80, arcade.color.GREEN) arcade.draw_ellipse_outline(self.green_circle_x, self.green_circle_y, 80, 80, arcade.color.YELLOW, 2) arcade.draw_text( f"green x: {self.green_circle_x:.2f} - green y: {self.green_circle_y:.2f}", 10, 720 - 20, arcade.color.GREEN, 16) # kék kör arcade.draw_ellipse_filled(self.blue_circle_x, self.blue_circle_y, 80, 80, arcade.color.BLUE) arcade.draw_ellipse_outline(self.blue_circle_x, self.blue_circle_y, 80, 80, arcade.color.YELLOW, 2) arcade.draw_text( f"blue x: {self.blue_circle_x:.2f} - blue y: {self.blue_circle_y:.2f}", 10, 720 - 40, arcade.color.BABY_BLUE, 16) # piros körvonal arcade.draw_ellipse_outline(self.red_circle_x, self.red_circle_y, 80, 80, arcade.color.RED, 2) arcade.draw_text( f"red x: {self.red_circle_x:.2f} - red y: {self.red_circle_y:.2f}", 10, 720 - 60, arcade.color.RED, 16)
def draw_hills(): """Draws hills""" arcade.draw_ellipse_filled(500, 150, 300, 200, arcade.csscolor.DARK_GREEN, 170) arcade.draw_ellipse_outline(500, 150, 300, 200, arcade.csscolor.DARK_OLIVE_GREEN, 5, 170) arcade.draw_ellipse_filled(750, 100, 600, 300, arcade.csscolor.DARK_GREEN) arcade.draw_ellipse_outline(750, 100, 600, 300, arcade.csscolor.DARK_OLIVE_GREEN, 5) arcade.draw_ellipse_filled(300, 100, 400, 200, arcade.csscolor.DARK_GREEN) arcade.draw_ellipse_outline(300, 100, 400, 200, arcade.csscolor.DARK_OLIVE_GREEN, 5) arcade.draw_ellipse_filled(0, 100, 800, 350, arcade.csscolor.DARK_GREEN) arcade.draw_ellipse_outline(0, 100, 800, 350, arcade.csscolor.DARK_OLIVE_GREEN, 5)
def on_draw(self): """ Render the screen. """ # Start the render process. This must be done before any drawing commands. arcade.start_render() # Draw a grid # Draw vertical lines every 120 pixels for x in range(0, 601, 120): arcade.draw_line(x, 0, x, 600, arcade.color.BLACK, 2) # Draw horizontal lines every 200 pixels for y in range(0, 601, 200): arcade.draw_line(0, y, 800, y, arcade.color.BLACK, 2) # Draw a point arcade.draw_text("draw_point", 3, 405, arcade.color.BLACK, 12) arcade.draw_point(60, 495, arcade.color.RED, 10) # Draw a set of points arcade.draw_text("draw_points", 123, 405, arcade.color.BLACK, 12) point_list = ((165, 495), (165, 480), (165, 465), (195, 495), (195, 480), (195, 465)) arcade.draw_points(point_list, arcade.color.ZAFFRE, 10) # Draw a line arcade.draw_text("draw_line", 243, 405, arcade.color.BLACK, 12) arcade.draw_line(270, 495, 300, 450, arcade.color.WOOD_BROWN, 3) # Draw a set of lines arcade.draw_text("draw_lines", 363, 405, arcade.color.BLACK, 12) point_list = ((390, 450), (450, 450), (390, 480), (450, 480), (390, 510), (450, 510)) arcade.draw_lines(point_list, arcade.color.BLUE, 3) # Draw a line strip arcade.draw_text("draw_line_strip", 483, 405, arcade.color.BLACK, 12) point_list = ((510, 450), (570, 450), (510, 480), (570, 480), (510, 510), (570, 510)) arcade.draw_line_strip(point_list, arcade.color.TROPICAL_RAIN_FOREST, 3) arcade.draw_line_strip(point_list, arcade.color.BEIGE) # Draw a polygon arcade.draw_text("draw_polygon_outline", 3, 207, arcade.color.BLACK, 9) point_list = ((30, 240), (45, 240), (60, 255), (60, 285), (45, 300), (30, 300)) arcade.draw_polygon_outline(point_list, arcade.color.SPANISH_VIOLET, 3) # Draw a filled in polygon arcade.draw_text("draw_polygon_filled", 123, 207, arcade.color.BLACK, 9) point_list = ((150, 240), (165, 240), (180, 255), (180, 285), (165, 300), (150, 300)) arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET) # Draw an outline of a circle arcade.draw_text("draw_circle_outline", 243, 207, arcade.color.BLACK, 10) arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3) arcade.draw_circle_outline(350, 285, 18, arcade.color.WISTERIA) # Draw a filled in circle arcade.draw_text("draw_circle_filled", 363, 207, arcade.color.BLACK, 10) arcade.draw_circle_filled(420, 285, 18, arcade.color.GREEN) # Draw an ellipse outline, and another one rotated arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.BLACK, 10) arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3) arcade.draw_ellipse_outline(540, 336, 15, 36, arcade.color.BLACK_BEAN, 3, 45) # Draw a filled ellipse, and another one rotated arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.BLACK, 10) arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER) arcade.draw_ellipse_filled(60, 144, 15, 36, arcade.color.BLACK_BEAN, 45) # Draw an arc, and another one rotated arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.BLACK, 10) arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON, 90, 360) arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90, 360, 45) # Draw an rectangle outline arcade.draw_text("draw_rect", 243, 3, arcade.color.BLACK, 10) arcade.draw_rectangle_outline(295, 100, 45, 65, arcade.color.BRITISH_RACING_GREEN) arcade.draw_rectangle_outline(295, 160, 20, 45, arcade.color.BRITISH_RACING_GREEN, 3, 45) # Draw a filled in rectangle arcade.draw_text("draw_filled_rect", 363, 3, arcade.color.BLACK, 10) arcade.draw_rectangle_filled(420, 100, 45, 65, arcade.color.BLUSH) arcade.draw_rectangle_filled(420, 160, 20, 40, arcade.color.BLUSH, 45) # Load and draw an image to the screen # Image from kenney.nl asset pack #1 arcade.draw_text("draw_bitmap", 483, 3, arcade.color.BLACK, 12) texture = arcade.load_texture("images/playerShip1_orange.png") scale = .6 arcade.draw_texture_rectangle(540, 120, scale * texture.width, scale * texture.height, texture, 0) arcade.draw_texture_rectangle(540, 60, scale * texture.width, scale * texture.height, texture, 45) color = arcade.get_pixel(100, 100) assert color == (255, 255, 255) image = arcade.get_image()
def do_draw_ellipse_outline(self): arcade.draw_ellipse_outline(400, 300, 230, 100, arcade.color.AZURE, 10, 45)
language and the Arcade library. """ # Import the "arcade" library import arcade # Open up a window. # From the "arcade" library, use a function called "open_window" # Set the window title to "Drawing Example" # Set the and dimensions (width and height) arcade.open_window(600, 600, "Drawing Example") # Set the background color arcade.set_background_color(arcade.csscolor.WHITE) # Get ready to draw arcade.start_render() # Draw an ellipse and rect with # a center of (300, 300) # width of 350 # height of 200 arcade.draw_rectangle_outline(300, 300, 350, 200, arcade.csscolor.BLACK, 3) arcade.draw_ellipse_outline(300, 300, 350, 200, arcade.csscolor.RED, 3) # Finish drawing arcade.finish_render() # Keep the window up until someone closes it. arcade.run()
def on_draw(self): self.parent.set_viewport(*self.viewport.as_tuple()) # update agent sprites self.update_agent_sprites() # build map VBO if necessary if self.tiles_vbo is None or self.fog: self.build_grid() # render main map tiles # fix projection each frame with self.tiles_vbo.vao: self.tiles_vbo.program['Projection'] = arcade.get_projection( ).flatten() # and draw self.tiles_vbo.draw() # render stuff on top of the map if self.map_items is None: self.build_map_items() # fix projection each frame with self.map_items.program: self.map_items.program['Projection'] = arcade.get_projection( ).flatten() # and draw self.map_items.draw() # draw noises for noise in self.world.noises + self.world.old_noises: radius = max( 0, noise.radius - (self.world.time_ticks - noise.time) * self.world.TIME_PER_TICK * 0.5 * noise.radius) if radius > 0: # and not noise.drawn: arcade.draw_ellipse_outline(noise.location.x, noise.location.y, radius, radius, arcade.color.AIR_FORCE_BLUE, border_width=0.2) # draw agent trails for ID, agent in self.world.agents.items(): arcade.draw_line_strip(self.agent_trails[agent], color=[int(255 * c) for c in agent.color]) # draw agents self.agent_sprites.draw() # change back to pixel viewport for the next WindowComponent self.parent.set_viewport(0, self.parent.SCREEN_WIDTH, 0, self.parent.SCREEN_HEIGHT) # print map position of the cursor location = self.screen_to_map(self.mouse_x, self.mouse_y, round=False) text = f"({location[0]:3.2f}, {location[1]:3.2f})" arcade.draw_lrtb_rectangle_filled(self.parent.SCREEN_WIDTH - 12 * len(text) - 6, self.parent.SCREEN_WIDTH, self.parent.SCREEN_HEIGHT, self.parent.SCREEN_HEIGHT - 24 - 6, color=(0, 0, 0, 192)) arcade.draw_text(text, self.parent.SCREEN_WIDTH - 12 * len(text), self.parent.SCREEN_HEIGHT - 24, arcade.color.WHITE, 16)
print("Body") def print_sun(): print("Sun") import arcade arcade.open_window(600, 600, "Chapter 5 Lab") # Set the background color arcade.set_background_color(arcade.csscolor.TOMATO) # Get ready to draw arcade.start_render() # Drawing code goes here # Three Blue Heads arcade.draw_ellipse_outline(100, 300, 60, 60, arcade.csscolor.DARK_BLUE, 3) arcade.draw_ellipse_outline(250, 300, 60, 60, arcade.csscolor.DARK_BLUE, 3) arcade.draw_ellipse_outline(400, 300, 60, 60, arcade.csscolor.DARK_BLUE, 3) # Three skinny rectangles arcade.draw_rectangle_filled(100, 245, 10, 60, arcade.csscolor.DARK_BLUE) arcade.draw_rectangle_filled(250, 325, 10, 100, arcade.csscolor.DARK_BLUE) arcade.draw_rectangle_filled(400, 300, 10, 150, arcade.csscolor.DARK_BLUE) # Finish drawing arcade.finish_render() # Keep the window open arcade.run()
# Small areas arcade.draw_polygon_outline([[253, 100], [270, 155], [530, 155], [547, 100]], (255, 255, 255), 4) arcade.draw_polygon_outline([[365, 500], [358, 475], [442, 475], [435, 500]], (255, 255, 255), 4) # Center line arcade.draw_line(130, 345, 670, 345, (255, 255, 255), 4) # Center circle arcade.draw_ellipse_outline(400, 345, 200, 120, (255, 255, 255), 4, 0, -1) # Exterior grey lines pretending to be the passageway of the stands for i in range(7): arcade.draw_line(0, 200 + i * 75, 180 - i * 27, 530 + i * 24, (115, 112, 108), 4) for i in range(7): arcade.draw_line(800, 200 + i * 75, 620 + i * 27, 530 + i * 24, (115, 112, 108), 4) for i in range(3): arcade.draw_line(180 - i * 27, 530 + i * 24, 620 + i * 27, 530 + i * 24, (115, 112, 108), 4)
arcade.draw_triangle_outline(200, 200, 360, 200, 290, 300, arcade.csscolor.BLACK, 3) # cabin door arcade.draw_lrtb_rectangle_filled(245, 285, 160, 92, arcade.csscolor.SADDLE_BROWN) arcade.draw_lrtb_rectangle_outline(245, 285, 160, 92, arcade.csscolor.BLACK, 2) arcade.draw_circle_filled(249, 126, 4, arcade.csscolor.GOLDENROD) arcade.draw_circle_outline(249, 126, 5, arcade.csscolor.BLACK, 2) # tree arcade.draw_lrtb_rectangle_filled(85, 110, 190, 90, arcade.color.BOLE) arcade.draw_lrtb_rectangle_outline(85, 110, 190, 90, arcade.color.BLACK, 2) arcade.draw_circle_filled(100, 190, 40, arcade.csscolor.DARK_GREEN) for x in range(0, 180, 25): arcade.draw_ellipse_outline(100, 190, 106, 51, arcade.csscolor.BLACK, 35, x) for x in range(0, 180, 25): arcade.draw_ellipse_filled(100, 190, 100, 45, arcade.csscolor.DARK_GREEN, x) # clouds def draw_cloud(cloud_x, cloud_y): arcade.draw_ellipse_filled(cloud_x, cloud_y, 150, 50, arcade.csscolor.WHITE) # using several ellipses to make one cloud rather than making a function that makes good clouds to save time draw_cloud(50, 325) draw_cloud(65, 350) draw_cloud(50, 375)
#Background arcade.draw_lrtb_rectangle_filled(0, 700, 280, 0, (112, 176, 0)) for i in range(z): for i in range(2): for i in range(r): arcade.draw_circle_filled(x, y, 25, arcade.color.WHITE_SMOKE) x += 20 y += 20 x -= 90 r = 4 r = 5 x = random.randrange(0, 701) y = random.randrange(500, 670) #Shadow arcade.draw_ellipse_filled(350, 200, 240, 30, arcade.color.BLACK) arcade.draw_ellipse_outline(350, 200, 240, 30, arcade.color.BLACK, 15) #Base arcade.draw_circle_filled(350, 385, 200, arcade.color.RED) arcade.draw_arc_filled(350, 385, 200, 200, arcade.color.WHITE, 0, 180, 180) #Tint arcade.draw_circle_filled(350, 460, 100, (235, 0, 0)) arcade.draw_circle_filled(375, 500, 20, (225, 220, 220)) arcade.draw_circle_outline(375, 500, 20, (225, 220, 220)) for i in range(3): arcade.draw_arc_outline(350, 390, 200, t, (205, 205, 205), 0, 180, 1000, 180) t += 5 #Middle arcade.draw_rectangle_filled(350, 385, 400, 30, arcade.color.BLACK) arcade.draw_circle_filled(350, 385, 60, arcade.color.BLACK) arcade.draw_circle_outline(350, 385, 60, arcade.color.BLACK)
(180, 285), (165, 300), (150, 300)) arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET) # Draw an outline of a circle arcade.draw_text("draw_circle_outline", 243, 207, arcade.color.WHITE, 10) arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3) # Draw a filled in circle arcade.draw_text("draw_circle_filled", 363, 207, arcade.color.WHITE, 10) arcade.draw_circle_filled(420, 285, 18, arcade.color.GREEN) # Draw an ellipse outline, and another one rotated arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.WHITE, 10) arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3) arcade.draw_ellipse_outline(540, 336, 15, 36, arcade.color.BLACK_BEAN, 3, 45) # Draw a filled ellipse, and another one rotated arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.WHITE, 10) arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER) arcade.draw_ellipse_filled(60, 144, 15, 36, arcade.color.BLACK_BEAN, 45) # Draw an arc, and another one rotated arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.WHITE, 10) arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON, 90, 360) arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90, 360, 45)
import random arcade.open_window(500, 400, "Julie Pham") arcade.set_background_color(arcade.color.LIGHT_BLUE) arcade.start_render() #neck arcade.draw_rectangle_filled(420, 280, 169, 47, arcade.color.BURLYWOOD, 190) #antler things point_list = ((300, 300), (300, 340), (320, 310), (340, 340), (340, 300)) arcade.draw_polygon_filled(point_list, arcade.color.ALLOY_ORANGE) #antlers arcade.draw_circle_filled(300, 340, 10, arcade.color.ALLOY_ORANGE) arcade.draw_circle_filled(340, 340, 10, arcade.color.ALLOY_ORANGE) #head arcade.draw_ellipse_filled(320, 280, 27, 30, arcade.color.BURLYWOOD) arcade.draw_ellipse_outline(320, 280, 27, 30, arcade.color.ALLOY_ORANGE) #nose arcade.draw_ellipse_filled(320, 240, 40, 25, arcade.color.ALLOY_ORANGE, 1) #left nostril arcade.draw_circle_filled(300, 240, 7, arcade.color.BLACK) #right nostril arcade.draw_circle_filled(340, 240, 7, arcade.color.BLACK) #1 arcade.draw_ellipse_filled(380, 287, 20, 15, arcade.color.ALLOY_ORANGE) #2 arcade.draw_arc_filled(430, 257, 20, 20, arcade.color.ALLOY_ORANGE, 18, 190) #3 arcade.draw_arc_filled(450, 310, 25, 15, arcade.color.ALLOY_ORANGE, 200, 380)
(180, 285), (165, 300), (150, 300)) arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET) # Draw an outline of a circle arcade.draw_text("draw_circle_outline", 243, 207, arcade.color.BLACK, 10) arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3) # Draw a filled in circle arcade.draw_text("draw_circle_filled", 363, 207, arcade.color.BLACK, 10) arcade.draw_circle_filled(420, 285, 18, arcade.color.GREEN) # Draw an ellipse outline, and another one rotated arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.BLACK, 10) arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3) arcade.draw_ellipse_outline(540, 336, 15, 36, arcade.color.BLACK_BEAN, 3, 45) # Draw a filled ellipse, and another one rotated arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.BLACK, 10) arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER) arcade.draw_ellipse_filled(60, 144, 15, 36, arcade.color.BLACK_BEAN, 45) # Draw an arc, and another one rotated arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.BLACK, 10) arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON, 90, 360) arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90, 360, 45)
arcade.draw_line(85, 370, 85, 295, (121, 123, 128), 5) arcade.draw_line(85, 295, 85, 250, (121, 123, 128), 5) # draw lines (right side of solar panels) arcade.draw_line(554, 370, 554, 295, (121, 123, 128), 8) arcade.draw_line(554, 295, 554, 250, (121, 123, 128), 8) arcade.draw_line(451, 370, 451, 295, (121, 123, 128), 8) arcade.draw_line(451, 295, 451, 250, (121, 123, 128), 8) arcade.draw_line(505, 370, 505, 295, (121, 123, 128), 5) arcade.draw_line(505, 295, 505, 250, (121, 123, 128), 5) # Draw a yellow ellipse arcade.draw_ellipse_filled(295, 402, 7, 105, (224, 188, 40), 90) arcade.draw_ellipse_outline(295, 402, 7, 105, (121, 123, 128), 1, 90) # draw spacecraft nose cone point_list = ((195, 405), (225, 450), (370, 450), (400, 405)) arcade.draw_polygon_filled(point_list, (203, 214, 214)) point_list = ((195, 405), (225, 450), (370, 450), (400, 405)) arcade.draw_polygon_outline(point_list, (121, 123, 128), 4) point_list = ((225, 450), (260, 495), (340, 495), (370, 450)) arcade.draw_polygon_filled(point_list, (203, 214, 214)) point_list = ((225, 450), (260, 495), (340, 495), (370, 450)) arcade.draw_polygon_outline(point_list, (121, 123, 128), 4) # Load image of spacex and dragon file_name = "C:\\Users\\Daniel Camacho\\Documents\\CMSC 150\\Lab 02-Draw a Picture\\SpaceX-Logo.svg.png"