idlerc.py
Randall Hopper
aa8vb at yahoo.com
Fri Feb 25 17:28:39 EST 2000
Bernhard Herzog:
|Randall Hopper <aa8vb at yahoo.com> writes:
|> Warren Postma:
|> |> Now is there a way to put these color settings in an ".idlerc" of sorts so
|> |> they're kept from version to version without hacking any source?
|> |
|> |How about checking your working (and home directory for unix} for an
|> |"idlerc.py" on Unix and if so, run it.
|>
|> Sounds good, but IDLE doesn't support it.
|
|Don't forget the time machine! It's a little known and perhaps
|undocumented feature of Tkinter that it tries to execute a coule of
|files in the user's home directory on startup. See the readprofile
|method of the Tk class in Tkinter.py.
That's good to know! I've not seen that in print before. (Fredrik, I see
this isn't mentioned in the latest draft. I think it's definitely worth a
mention)
|In IDLE'S case, one of the files is ~/.idle.py.
|
|I don't use IDLE myself, but I just tried it with the version that comes
|with 1.5.2 and it works.
It didn't work for me. No matter whether I invoke "idle.py" directly or
run "python idle.py", it didn't touch ~/.idle.py (I know because I put a
print and a sys.exit in there).
Under the hood, baseName and className (args to Tk() are left to their
defaults. sys.argv[0] is empty (?). And the reason is that IDLE is
hacking up sys.argv for some reason when -e isn't specified, which prevents
baseName from being set, which causes Tkinter to look for these files:
/home/rhh/.Tk.tcl /home/rhh/.Tk.py /home/rhh/..tcl /home/rhh/..py
and which therefore prevents .idle.py from being read by Tkinter.
Seeing this, I verified that IDLE does indeed read ~/.idle.py when invoked
as "idle.py -e".
This appears to be a bug. If there are no objections after a while, I'll
go ahead and file it.
|On potential problem is that this happens very early on and important
|parts of IDLE might not be initialized yet. In Sketch at least this
|feature is practically worthless because of that.
I see.
IDLE as-is doesn't appear to be coded to allow an override of class
ColorPrefs by Tkinter.
I'd code up a quick patch, but I can't figure where in the world the
symbols defined in ~/.idle.py are getting placed ! (From Tkinter.py, it
looks like they should be in _default_root, but apparently not...)
--
Randall Hopper
aa8vb at yahoo.com
More information about the Python-list
mailing list