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) x...@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 ejg_...@yahoo.com.
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
import Tkinter root = Tkinter.Tk() fr1 = Tkinter.Frame(master=root) fr1.grid() # Adding the following line, with either pack or grid, seems # to make an endless loop. Tkinter.Label(text='first frame',master=fr1).pack() fr2 = Tkinter.Frame(master=root) Tkinter.Label(text='testing', master=fr2).pack() fr2.pack() root.mainloop()
------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users