try: from Tkinter import * except ImportError: from tkinter import * class WidgetRedirector: def __init__(self, widget): self._operations = {} self.widget = widget # widget instance self.tk = tk = widget.tk # widget's root w = widget._w # widget's (full) Tk pathname self.orig = w + "_orig" # Rename the Tcl command within Tcl: tk.call("rename", w, self.orig) # Create a new Tcl command whose name is the widget's pathname, and # whose action is to dispatch on the operation passed to the widget: tk.createcommand(w, self.dispatch) def close(self): widget = self.widget; del self.widget orig = self.orig; del self.orig tk = widget.tk w = widget._w tk.deletecommand(w) # restore the original widget Tcl command: tk.call("rename", orig, w) def dispatch(self, operation, *args): print(len(args)) for i, s in enumerate(args): # XXX: you cannot print last element print(i, s) m = self._operations.get(operation) try: if m: return m(*args) else: return self.tk.call((self.orig, operation) + args) except TclError: return "" root = Tk() text = Text(root) redr = WidgetRedirector(text) color = "black" # whatever you want text.config( foreground=color, background=color, insertbackground=color, selectforeground=color, selectbackground=color, ) text.pack() redr.close() root.mainloop()