Matplotlib metrics do not work after dialog with Tkinter file

I am using the following function, which I found as an answer to this question , to display a dialog box for selecting a file.

[Edit: It turns out that the differences in distributions are here simply because Matplotlib uses gtk3agg for Fedora and TkAgg to draw windows on each system]

In Fedora 18: Everything works fine.

In Ubuntu 12.10: Matplotlib freezes after closing any shape displayed after a dialog with a file. For example, in the code below on Ubuntu, I can never get to the line "did it". I can still enter the terminal, although nothing happens. If I remove the file dialog box, Matplotlib metrics will work as expected.

import Tkinter, tkFileDialog import pylab def ask_for_config_file(): print "Please provide location of configuration file." root = Tkinter.Tk() root.withdraw() file_path = tkFileDialog.askopenfilename() return file_path def main(): config_file_path = ask_for_config_file() pylab.figure() pylab.show() print "Made it." 

Any suggestions?

+2
source share
1 answer

I just needed root.destroy() at the end of the dialog function!

+2
source

All Articles