Skip to content

Commit 6510708

Browse files
authored
Merge branch 'master' into martin-update-bootstrap
2 parents b66a6d1 + 4bff241 commit 6510708

File tree

181 files changed

+308906
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+308906
-26
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
# Download and cache dependencies
1717
- restore_cache:
1818
keys:
19-
- v1-dependencies-{{ checksum ".circleci/requirements.txt" }}
19+
- v1-dependencies-{{ checksum "requirements.txt" }}
2020
# fallback to using the latest cache if no exact match is found
2121
- v1-dependencies-
2222

@@ -26,12 +26,12 @@ jobs:
2626
python3 -m venv venv
2727
. venv/bin/activate
2828
pip install --upgrade pip
29-
pip install -r .circleci/requirements.txt
29+
pip install -r requirements.txt
3030
3131
- save_cache:
3232
paths:
3333
- ./venv
34-
key: v1-dependencies-{{ checksum ".circleci/requirements.txt" }}
34+
key: v1-dependencies-{{ checksum "requirements.txt" }}
3535

3636
- run:
3737
name: Code style check

.circleci/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
**Where to put new files:**
2+
3+
- New files should go into a top-level subfolder, named after the article slug. For example: `my-awesome-article`
4+
15
**How to merge your changes:**
26

3-
1. Make sure the CI code style tests all pass.
7+
1. [Make sure the CI code style tests all pass (+ run the automatic code formatter if necessary).](https://github.com/realpython/materials/blob/master/README.md)
48
2. Find an RP Team member on Slack and ask them to review & approve your PR.
59
3. Once the PR has one positive ("approved") review, GitHub lets you merge the PR.
610
4. 🎉

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ $ black --check .
1717

1818
## Running Python Code Formatter
1919

20+
We're using a tool called [black](https://github.com/ambv/black) on this repo to ensure consistent formatting. On CI it runs in "check" mode to ensure any new files added to the repo are following PEP 8. If you see linter warnings that say something like "would reformat some_file.py" it means black disagrees with your formatting.
21+
22+
**The easiest way to resolve these errors is to just run Black locally on the code and then committing those changes, as explained below.**
23+
2024
To automatically re-format your code to be consistent with our code style guidelines, run [black](https://github.com/ambv/black) in the repository root folder:
2125

2226
```sh

arcade-a-primer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Source files supporting the **Arcade - A Modern Python Game Framework** article

arcade-a-primer/arcade_basic.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Basic arcade program
2+
# Displays a white window with a blue circle in the middle
3+
4+
# Imports
5+
import arcade
6+
7+
# Constants
8+
SCREEN_WIDTH = 600
9+
SCREEN_HEIGHT = 800
10+
SCREEN_TITLE = "Welcome to Arcade"
11+
RADIUS = 150
12+
13+
# Open the window
14+
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
15+
16+
# Set the background color
17+
arcade.set_background_color(arcade.color.WHITE)
18+
19+
# Clear the screen and start drawing
20+
arcade.start_render()
21+
22+
# Draw a blue circle
23+
arcade.draw_circle_filled(
24+
SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, RADIUS, arcade.color.BLUE
25+
)
26+
27+
# Finish drawing
28+
arcade.finish_render()
29+
30+
# Display everything
31+
arcade.run()
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Basic arcade program using objects
2+
# Displays a white window with a blue circle in the middle
3+
4+
# Imports
5+
import arcade
6+
7+
# Constants
8+
SCREEN_WIDTH = 600
9+
SCREEN_HEIGHT = 800
10+
SCREEN_TITLE = "Welcome to Arcade"
11+
RADIUS = 150
12+
13+
# Classes
14+
15+
16+
class Welcome(arcade.Window):
17+
"""Our main welcome window
18+
"""
19+
20+
def __init__(self):
21+
"""Initialize the window
22+
"""
23+
24+
# Call the parent class constructor
25+
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
26+
27+
# Set the background window
28+
arcade.set_background_color(arcade.color.WHITE)
29+
30+
def on_draw(self):
31+
"""Called whenever we need to draw our window
32+
"""
33+
34+
# Clear the screen and start drawing
35+
arcade.start_render()
36+
37+
# Draw a blue circle
38+
arcade.draw_circle_filled(
39+
SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, RADIUS, arcade.color.BLUE
40+
)
41+
42+
43+
# Main code entry point
44+
if __name__ == "__main__":
45+
app = Welcome()
46+
arcade.run()
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Basic arcade program using objects
2+
# Draw shapes on screen
3+
4+
# Imports
5+
import arcade
6+
7+
# Constants
8+
SCREEN_WIDTH = 600
9+
SCREEN_HEIGHT = 650
10+
SCREEN_TITLE = "Draw Shapes"
11+
12+
# Classes
13+
14+
15+
class Welcome(arcade.Window):
16+
"""Our main welcome window
17+
"""
18+
19+
def __init__(self):
20+
"""Initialize the window
21+
"""
22+
23+
# Call the parent class constructor
24+
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
25+
26+
# Set the background window
27+
arcade.set_background_color(arcade.color.WHITE)
28+
29+
def on_draw(self):
30+
"""Called whenever we need to draw our window
31+
"""
32+
33+
# Clear the screen and start drawing
34+
arcade.start_render()
35+
36+
# Draw a blue arc
37+
arcade.draw_arc_filled(100, 100, 40, 40, arcade.color.BLUE, 0, 125)
38+
39+
# Draw a red ellipse
40+
arcade.draw_ellipse_outline(
41+
300, 100, 60, 30, arcade.color.RED, border_width=2
42+
)
43+
44+
# Draw some purple lines
45+
arcade.draw_line(500, 100, 550, 100, arcade.color.PURPLE)
46+
arcade.draw_line(500, 90, 550, 90, arcade.color.PURPLE, line_width=2)
47+
arcade.draw_line(500, 80, 550, 80, arcade.color.PURPLE, line_width=3)
48+
49+
# Draw an orange parabola
50+
arcade.draw_parabola_filled(100, 100, 130, 120, arcade.color.ORANGE)
51+
52+
# Draw a black point
53+
arcade.draw_point(300, 300, arcade.color.BLACK, 20)
54+
55+
# Draw a green polygon
56+
points_list = [
57+
[500, 300],
58+
[550, 300],
59+
[575, 325],
60+
[550, 350],
61+
[525, 340],
62+
]
63+
arcade.draw_polygon_outline(
64+
points_list, arcade.color.GREEN, line_width=5
65+
)
66+
67+
# Draw some rectangles
68+
arcade.draw_rectangle_filled(100, 500, 150, 75, arcade.color.AZURE)
69+
arcade.draw_lrtb_rectangle_filled(
70+
150, 250, 575, 525, arcade.color.AMARANTH_PINK
71+
)
72+
arcade.draw_xywh_rectangle_filled(
73+
200, 550, 150, 75, arcade.color.ASPARAGUS
74+
)
75+
76+
# Draw some triangles
77+
arcade.draw_triangle_filled(
78+
400, 500, 500, 500, 450, 575, arcade.color.DEEP_RUBY
79+
)
80+
81+
82+
# Main code entry point
83+
if __name__ == "__main__":
84+
app = Welcome()
85+
arcade.run()

0 commit comments

Comments
 (0)