Tkinter changing the select background color on an unfocused Text widget
Digging through the Tk source code lead me to the answer! The inactiveselectbackground
option sets the color.
import Tkinter as tkroot = tk.Tk()# Create a Text widget with a red selected text background# And green selected text background when not focusedtext = tk.Text(root, selectbackground="red", inactiveselectbackground="green")text.pack()# Add some text, and select ittext.insert("1.0", "Hello, world!")text.tag_add("sel", "1.0", "end")# Create an Entry widget to easily test the focus behaviorentry = tk.Entry(root)entry.pack()entry.insert("0", "Focus me!")root.mainloop()