# Main Module

Pulls everything together.

class `joy.vui.main.``FileFaker`(log)

  Pretends to be a file object but writes to log instead.

  `write`(text)

    Write text to log.

`joy.vui.main.``error_guard`(loop, n=10)

  Run a loop function, retry for `n` exceptions. Prints tracebacks on `sys.stderr`.

`joy.vui.main.``init`()

  Initialize the system.

  - Init PyGame
  - Create main window
  - Start the PyGame clock
  - Set the event mask
  - Create the PersistTask

`joy.vui.main.``init_context`(screen, clock, pt)

  More initialization

  - Create the Joy dictionary
  - Create the Display
  - Open the log, menu, and scratch text viewers, and the stack pickle
  - Start the main loop
  - Create the World object
  - Register PersistTask and World message handlers with the Display
  - Load user function definitions.

`joy.vui.main.``load_definitions`(pt, dictionary)

  Load definitions from `definitions.txt`.

`joy.vui.main.``load_primitives`(home, name_space)

  Load primitives from `library.py`.

`joy.vui.main.``main`(screen, clock, pt)

  Main function.

  - Call `init_context()`
  - Load primitives
  - Create an `evaluate` function that lets you just eval some Python code
  - Redirect `stdout` to the log using a `FileFaker` object, and…
  - Start the main loop.