-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Expand file tree
/
Copy patharcade_basic_oop.py
More file actions
43 lines (30 loc) · 962 Bytes
/
arcade_basic_oop.py
File metadata and controls
43 lines (30 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Basic arcade program using objects
# Displays a white window with a blue circle in the middle
# Imports
import arcade
# Constants
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 800
SCREEN_TITLE = "Welcome to Arcade"
RADIUS = 150
# Classes
class Welcome(arcade.Window):
"""Our main welcome window"""
def __init__(self):
"""Initialize the window"""
# Call the parent class constructor
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
# Set the background window
arcade.set_background_color(arcade.color.WHITE)
def on_draw(self):
"""Called whenever we need to draw our window"""
# Clear the screen and start drawing
arcade.start_render()
# Draw a blue circle
arcade.draw_circle_filled(
SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, RADIUS, arcade.color.BLUE
)
# Main code entry point
if __name__ == "__main__":
app = Welcome()
arcade.run()