[Idle-dev] modifying color rules
Kurt B. Kaiser
kbk at shore.net
Fri Dec 19 11:45:24 EST 2003
Luke Bradley <webworldl at yahoo.com> writes:
> I'm interested in changing the coloring rules in idle for a
> different type of file, one that includes python embedded in
> HTML. This file type is my own creation and has a different suffix.
> I was wondering if any of the developers being familiar with the
> code structure know of a quick way to apply a different set of
> coloring rules for a different type of file, or a good place to jump
> into the code for this type of thing.
There hasn't been any attempt to generalize IDLE to handle different
languages. However, you should not have much difficulty doing what
you want to do. Take a look at
Colorizing is handled by EditorWindow.py and ColorDelegator.py. File
I/O is handled by IOBinding.py. The color configuration is loaded
from config-highlight.def by configHandler.py when an EditorWindow is
initialized. config-highlight.def is set up by configDialog.py.
IDLE can modify itself. Since we currently can have only one instance
of IDLE running a subprocess, what I often do is start a copy of IDLE
with the -n switch and use that to edit the code. Then I use another
copy w/o the switch for testing.
If IDLE is started with the -n switch, the debugger will trace through
IDLE itself. Otherwise, it will only trace user code.
More information about the IDLE-dev