-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchapter_2.py
35 lines (25 loc) · 998 Bytes
/
chapter_2.py
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
import arcade
import settings
class Chapter2View(arcade.View):
def on_show(self):
arcade.set_background_color(arcade.color.BLUE_SAPPHIRE)
def on_draw(self):
arcade.start_render()
arcade.draw_text("Chapter 2", settings.WIDTH / 2, settings.HEIGHT / 2,
arcade.color.BLACK, font_size=30, anchor_x="center")
def on_key_press(self, key, modifiers):
self.director.next_view()
if __name__ == "__main__":
"""This section of code will allow you to run your View
independently from the main.py file and its Director.
You can ignore this whole section. Keep it at the bottom
of your code.
It is advised you do not modify it unless you really know
what you are doing.
"""
from utils import FakeDirector
window = arcade.Window(settings.WIDTH, settings.HEIGHT)
my_view = Chapter2View()
my_view.director = FakeDirector(close_on_next_view=True)
window.show_view(my_view)
arcade.run()