##
21.1 Creating a canvas

A new canvas is created by calling the class static method `canvas.init`. It is closed by calling the `close()` method of the canvas object.

`init`( | fname=None format=None)

  This is a "factory" procedure that creates a new canvas.T object. Both parameters, fname and format, are optional. Parameter fname specifies either the output file name or a file object. Parameter format, if specified, defines the file's format. Its value must be one of "ps", "pdf", "svg", "x11", or "png".

  When fname is omitted or is None, the output is sent to standard output. When format is omitted, it is guessed from the fname's suffix; failing that, "ps" is selected.

`close`( | )

  This method closes the canvas and writes contents to the associated file. Calling this procedure is optional, because Pychart calls this procedure for every open canvas on normal exit.