Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: 9150566f5b333c97d814225f28dd91ef7a7de217
Ticket: 3609608fffffffffffffffffffffffffffffffff
Windows Text hi-lights disappear when text loses focus
User & Date: roseman 2015-08-31 19:09:37
Changes

  1. assignee changed to: "aku"
  2. closer changed to: "nobody"
  3. comment changed to:
    On Windows the text widget hi-lights will disappear when text widget loses focus.  Linux and Mac OS X Tk behaves appropriately.  This bug is generated from a number of bugs for IDLE (Python's IDE) here http://bugs.python.org/issue14146.  On Windows the IDLE debugger no longer hi-lights the current line in the editor.  On Windows the find/replace functions are not functioning properly because found text is not hi-lighted.  The issue was tested using Tk 8.5.13 and Tk 8.6 both exhibit the same problem.  We created a small test program to reproduce this bug with Python 3.x and tkinter:
    
    from tkinter import *
    
    main = Tk()
    text = Text(main, width=40, height=10, wrap="char")
    text.pack()
    text.insert(INSERT, "".join(map(str, range(100))))
    text.tag_add(SEL, "1.0", "end")
    text.focus_set()
    
    def jump():
        text.after(500, btn.focus_set)
        text.after(1000, text.focus_set)
    
    btn = Button(main, text="Click me", command=jump)
    btn.pack()
    main.mainloop()
    
    Thanks for your help!
    
  4. icomment:
    This can be fixed by using the "inactiveselectbackground" option for text widgets. Not sure if it's correct that this defaults to empty on win32 or not...
    
  5. login: "roseman"
  6. mimetype: "text/plain"
  7. severity changed to: "Minor"
  8. username: "roseman"