open bug: losing focus after saving in interactive mode

John was asking whether there was something left to be fixed

    > befor 0.88. In 0.87.3, there is still a bug left that has
    > been reported several times I think.

Interesting. the tk ask file dialog seems to be triggering a destgroy
event on the main window, which removes it from mpl figure
management. Here is a minimal Tk script which exposes the problem.
When you press the mouse button, you get a file dialog that when you
close it triggers a destroy event and calls the callback function

I don't know if this is a tk bug or if we are misusing the Tk code.
Tk experts?

I'll post on python-list.

JDH

import Tkinter as Tk
from tkFileDialog import asksaveasfilename

def button(event):
    fname = asksaveasfilename(
        title='Save the figure'
        )

window = Tk.Tk()
frame = Tk.Frame(window, width=500,height=500)
frame.bind('<Button-1>', button)
frame.pack()

def callback(*args):
    print 'called callback'
window.bind("<Destroy>", callback)

window.mainloop()

The weird thing is that this used to work fine in the past.
At least, I am pretty sure it did.
Then again, I am watching the Worlcup final at this time.
So a significant part of my brain is doing something else,
Mark

···

On 7/9/06, John Hunter <jdhunter@…5…> wrote:

> John was asking whether there was something left to be fixed
> befor 0.88.  In 0.87.3, there is still a bug left that has
> been reported several times I think.

Interesting. the tk ask file dialog seems to be triggering a destgroy
event on the main window, which removes it from mpl figure

management. Here is a minimal Tk script which exposes the problem.
When you press the mouse button, you get a file dialog that when you
close it triggers a destroy event and calls the callback function

I don’t know if this is a tk bug or if we are misusing the Tk code.

Tk experts?

I’ll post on python-list.

JDH

import Tkinter as Tk
from tkFileDialog import asksaveasfilename

def button(event):
fname = asksaveasfilename(
title=‘Save the figure’

    )

window = Tk.Tk()
frame = Tk.Frame(window, width=500,height=500)
frame.bind(‘’, button)
frame.pack()

def callback(*args):
print ‘called callback’

window.bind(“”, callback)

window.mainloop()