Determining Presence Of GUI Support
Gerhard Häring
gerhard.haering at gmx.de
Sat Nov 9 10:34:28 EST 2002
* Tim Daneliuk <tundra at tundraware.com> [2002-11-09 06:40 +0000]:
> Is there a portable method of determining whether the current runtime
> environment supports a GUI or text-based interface? I would like to
> write a single program which autosenses the presentation environment
> and works accordingly.
You can obtain wether or not you're running under X11 by checking for
the existence of the "DISPLAY" environment variable:
>>> import os
>>> "DISPLAY" in os.environ
1
-- Gerhard
More information about the Python-list
mailing list