The Python X Library - Unix Display Names

Go to the first, previous, next, last section, table of contents.

## Unix Display Names

A display name on Unix has the following syntax:

    [hostname]:displayno[.screenno]

If hostname is omitted this refers to a display on the same machine as the client is running on. A Unix socket is used to connect to the display identified by `displayno`, which must be an integer from 0 and upwards.

If hostname is specified, it gives the network name or IP-number of the machine to contact. A TCP socket is used, connecting to port 6000+displayno on hostname.

If the display contains more than one screen, screenno can be specified to make another screen than 0 the default screen. If the number is larger than the available maximum screen number, it will be set to the maximum.

A few examples:

    :0           Display 0 on this host, connects to the Unix socket
                 /tmp/.X11-unix/X0
    :0.1         Same as above, but specifying a different default screen

    myhost:0     Display 0 on myhost, connects to TCP port 6000
    myhost:10    Display 10 on myhost, connects to TCP port 6010

    localhost:0  Display 0 on localhost, i.e. the same host as the client
                 runs on.  Uses a TCP socket, while :0 uses a Unix socket

The default display name is stored in the environmental variable `DISPLAY`. If that isn't set, `error.DisplayNameError` is raised.

Go to the first, previous, next, last section, table of contents.