Re: Dumb Newbie Question: no $DISPLAY environment variable
From: Andreas Leitgeb (avl_at_gamma.logic.tuwien.ac.at)
Date: 03/02/04
- Next message: Donald Arseneau: "Re: String or numeric in Entry field ?"
- Previous message: emmanuel: "String or numeric in Entry field ?"
- In reply to: Darren New: "Re: Dumb Newbie Question: no $DISPLAY environment variable"
- Next in thread: Tom Cat: "Re: Dumb Newbie Question: no $DISPLAY environment variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 02 Mar 2004 09:26:37 GMT
Darren New <dnew@san.rr.com> wrote:
> Amazing how folks will tell you to brace expr args because someone might
> pass in [exec format c:\\] or some such, and then mention "by the way,
> open your box up to every keyboard sniffer on the planet." ;-)
>
Easily explained: The "brace expr args" folks are likely entirely
disjoint from the "open your machine to the world" folks.
For the original poster: I'd assume that you're talking about your
home-computer where you are your only user, and your display is
always ":0.0".
To get it working, you need two variables:
set env(DISPLAY) :0.0
set env(XAUTHORITY) $env(HOME)/.Xauthority
after(!) that you add:
package require Tk
and make the script a tclsh-script (not wish!).
if you leave it as a wish-script, the env-setting are too late to
have any effect.
Thus, the script should start as follows:
--- snip start of script ---
#!/usr/bin/env tclsh
set env(DISPLAY) :0.0
set env(XAUTHORITY) $env(HOME)/.Xauthority
package require Tk
--- snip end of script-header. add your code below ---
The /usr/bin/env trick usually saves me from guessing your
tclsh-location. (There also exist other tricks to achieve
this effect)
Also remember to put it in your personal crontab rather than
the global /etc/crontab or otherwise it will not know your
Homedirectory. If your tclsh is not located in /usr/bin
(nor in /bin) you might need to specify its absolute path,
rather than rely on the /usr/bin/env-trick.
- Next message: Donald Arseneau: "Re: String or numeric in Entry field ?"
- Previous message: emmanuel: "String or numeric in Entry field ?"
- In reply to: Darren New: "Re: Dumb Newbie Question: no $DISPLAY environment variable"
- Next in thread: Tom Cat: "Re: Dumb Newbie Question: no $DISPLAY environment variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]