## 3 Connect to a Display

To be able to perform any X operations, you must first establish a connection to the display. This is done by instantiating a `display.Display` object:

Class: Display ( [ displayname ] )

  Create a connection to the display called displayname. If displayname is None or not provided, connect to the default display.

  If the connection fails for some reason, one of the errors from the following error class tree is raised:

      Exception
       \_error.DisplayError
          \_error.DisplayNameError
          \_error.DisplayConnectionError

  `error.DisplayNameError` is raised if displayname, or the default display name, is malformed. `error.DisplayConnectionError` is raised if the connection to the X server fails. This might be caused by the network connection to the display failing, or if the client isn’t authorized to connect to the display.

The syntax of a display name and how the library finds the default display name depends on the operating system where the client runs.