On 06/15/2010 08:02 AM, Eliot Glairon wrote:
> Hello. Through accident, I found that running the following script will freeze the computer. On my computer, the mouse still worked, but everything else still froze. I have minimalized the code and attached the script for your convienence:
>
> import matplotlib
> matplotlib.use('TkAgg')
> import matplotlib.pyplot as plt
> import Tkinter
> from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
> from matplotlib.figure import Figure
> class simpleapp_tk(Tkinter.Tk):#initialize
> def __init__(self,parent):
> Tkinter.Tk.__init__(self,parent)
> self.grid()
> self.figure = Figure(figsize=(5,4), dpi=100)
> canvas = FigureCanvasTkAgg(self.figure, master=self)
> canvas.show()
> canvas.get_tk_widget().grid(row=0,column=0)
> toolbar = NavigationToolbar2TkAgg( canvas, self )
>
> if __name__ == "__main__":
> app = simpleapp_tk(None)
> app.title('Freezing computer...')
> app.mainloop()
>
> I am running this on linux, YYY is my computer's name (confidential)
> XXX@YYY:~$ uname -a
> Linux YYY 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686 GNU/Linux
>
> I obtained my version from the linux repositories.
>
> Mail me back if you fixed this bug or have any questions at ej...@ya....
I am not sure there is anything matplotlib can do about this. You can
get into trouble mixing the packer (which matplotlib uses) with the grid
manager even with straight Tkinter. An example is attached. It doesn't
freeze X like your example, but it does sit in an endless loop.
In your example, I find that using ctrl-alt-F2 I can get to a console,
but from there I haven't found any solution better than rebooting.
Killing X should be an alternative, but it not as simple or obvious as
it used to be. (I am also using ubuntu 10.04, but I run mpl from svn.)
Eric
|