pythonpython-idlecaretblink

Stop cursor blinking in IDLE


Python beginner here. Blinking cursors in interfaces really distract me and the one in Idle doesn't have the option to stop blinking.

I've found this https://bugs.python.org/issue4630 which shows how to modify 2 lines of code in the idlelib/EditorWindow.py file to stop the cursor from blinking. But it is either for version 2.6 or 3. I currently use 2.7 and obviously the code is not the same nor located at the same lines.

Could someone more savvy in this language please let me know where can I find the necessary lines and how to modify them so that I can have make this modification ?


Solution

  • In 2.7 to 3.5, Lib/idlelib/EditorWindow.py, around line 185, or in 3.6+, Lib/idlelib/editor.py, currently around line 185 (but this may change), one can find

    text_options = {
            'name': 'text',
            'padx': 5,
            'wrap': 'none',
            'highlightthickness': 0,
            'width': self.width,
            'height': idleConf.GetOption(
                'main', 'EditorWindow', 'height', type='int')}
    

    Before the last line, insert

            'insertofftime': 0,
    

    either on a new line or to the end of an existing line. I tested this on both 2.7 and 3.6.

    EDIT: For current 3.9+, on the top menu, select Options and Configure IDLE. On the Settings dialog, select the Windows tab. There is a "Cursor blink" checkbox on the third line.