Hi Geoff, On Fri, 15 Jan 2010 21:13:22 +0100 Geoff Bache <geoff.ba...@gmail.com> wrote:
> Hi again Michael, > > > > > Hmm, from your previous posts I thought you would just do the call > > to root.after_idle(self.replayEvents) right before root.mainloop() ? > > If so, why not do > > > > root.deiconify() > > root.update() > > root.after_idle(self.replayEvents) > > root.mainloop() > > The problem is that I have to break in by intercepting something as > the application code doesn't know I exist :) > > At the moment I'm intercepting the construction of Tk() which is > guaranteed to happen and is easy to intercept. Intercepting mainloop > is more problematic because all widgets have a mainloop method and > there's no knowing which one the application will call. So you override Tkinter.Tk() ? If yes, it should be possible to override mainloop() as well. In fact all widgets share the same mainloop() method defined in Tkinter.Misc, which is very easy to override: import Tkinter class Tk(Tkinter.Tk): def __init__(self, *args, **kw): Tkinter.Tk.__init__(self, *args, **kw) def mainloop(w, n=0): # your code here... print 'Running mainloop through widget', w._w self.tk.mainloop(n) Tkinter.Misc.mainloop = mainloop root = Tk() b = Tkinter.Button(root, text='quit', command=root.quit) b.pack(padx=100, pady=100) b.focus_set() b.mainloop() Regards Michael _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss