[Tutor] Finding out if we can use a graphical environment or not

Magnus Lyckå magnus@thinkware.se
Wed Jul 16 17:41:31 2003


At 19:13 2003-07-16 +0100, Alan Gauld wrote:
>But its not foolproof. eg. I set DISPLAY in my .login/.profile file
>but I only start X when I need to. So the env var can be set but
>X not running. I'd check a 'ps' listing for a process called 'X'

'X' would be the X server, right? That might not be running on the
same machine as the python script. (In the strange client/server
application X11, the server is the machine you sit by, and the
client is the (possibly remote) machine where your application is
running.)

In other words, it's only if DISPLAY indicates the local machine
that checking for a local process makes sense.

I'm not sure it's correct to have an environment set up to
indicate a certain DISPLAY if that doesn't exist. I think a lot
of Unix programs assume that DISPLAY actually indicates something
that exists.

It seems that the DISPLAY environment variable is a better
indication of a present X Windows display capability in Unix
that a certain process name...but I suppose we deviated a bit
from Python now...


--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language