menu_01.py Full Listing
menu_01.py
1"""
2Menu.
3
4Shows the usage of almost every gui widget, switching views and making a modal.
5"""
6import arcade
7
8# Screen title and size
9SCREEN_WIDTH = 800
10SCREEN_HEIGHT = 600
11SCREEN_TITLE = "Making a Menu"
12
13
14class MainView(arcade.View):
15 """ Main application class."""
16
17 def __init__(self):
18 super().__init__()
19
20 def on_show_view(self):
21 """ This is run once when we switch to this view """
22 arcade.set_background_color(arcade.color.DARK_BLUE_GRAY)
23
24 def on_draw(self):
25 """ Render the screen. """
26 # Clear the screen
27 self.clear()
28
29
30def main():
31 window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE, resizable=True)
32 main_view = MainView()
33 window.show_view(main_view)
34 arcade.run()
35
36
37if __name__ == "__main__":
38 main()