- Each component must be in a separate class, in a separate file
- Each component must have a
render
method. - The
render
method must only be concerned with rendering the component and nothing else. - If data manipulation is needed, separate method must be created and called.
- In each component class, member functions must be placed alphabetically. The
render
method must be placed at the bottom. - Any sub-render method (ex:
render_button
,render_title
etc) must be placed before render, in alphabetically. - Any data that belongs to any of the following categories, must be kept in
utils.py
: - Needed frequently
- Needed in multiple components
- Loaded from a file (ex: audio, images, fonts etc)
- Each component that is concerned with pygame events must have an
event_handler
method, which may call other member functions - The
event_handler
member must be placed right after__init__
- Importing modules must be broken into following categories, alphabetically:
- Import from
utils.py
- Python packages
- Components (Button, Text, Menu etc)
- In any category,
from X import Y
must be placed aboveimport X
- If, at any point, line-width exceeds 80 characters, write all items in multiple lines, wrapped in parenthesis. The closing parenthesis must stay with last item.