Happy Face

This example shows how to use the Arcade drawing commands.

Screenshot of drawing example program
happy_face.py
 1"""
 2Drawing an example happy face
 3
 4If Python and Arcade are installed, this example can be run from the command line with:
 5python -m arcade.examples.happy_face
 6"""
 7
 8import arcade
 9
10# Set constants for the screen size
11SCREEN_WIDTH = 600
12SCREEN_HEIGHT = 600
13SCREEN_TITLE = "Happy Face Example"
14
15# Open the window. Set the window title and dimensions
16arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
17
18# Set the background color
19arcade.set_background_color(arcade.color.WHITE)
20
21# Clear screen and start render process
22arcade.start_render()
23
24# --- Drawing Commands Will Go Here ---
25
26# Draw the face
27x = 300
28y = 300
29radius = 200
30arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW)
31
32# Draw the right eye
33x = 370
34y = 350
35radius = 20
36arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)
37
38# Draw the left eye
39x = 230
40y = 350
41radius = 20
42arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)
43
44# Draw the smile
45x = 300
46y = 280
47width = 120
48height = 100
49start_angle = 190
50end_angle = 350
51arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK,
52                        start_angle, end_angle, 10)
53
54# Finish drawing and display the result
55arcade.finish_render()
56
57# Keep the window open until the user hits the 'close' button
58arcade.run()