Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
i understand that from wx import * should work, but it seems that it's not going to work anytime soon with wx2.8 it works as expected. good Anyhow, I don't plan an upload to just fix these examples, so this bug will be fixed when upstream will release a new version. that's ok for me thank you Sandro gb -- asdef This message was sent using IMP, the Internet Messaging Program. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
Hi Giacomo, sorry for the delay. On Fri, Mar 6, 2009 at 08:48, Giacomo Boffi giacomo.bo...@polimi.it wrote: Sandro Tosi writes: about --- from wx import * --- Mh, there is no reasons why from module import * should not work, and indeed there is a bug already reported about it: #488532 i have googled around, it seems that this problem was repeatedly reported to distributions and upstream, but never resolved the usual upstream reply is sort of from * import * is bad practice anyway, please do import wx about --- import wx.aui --- This is because the default python wrapper on your machine is v2.6, on 2.8 that module is present: i had both the 2.6 and the 2.8 wrappers, both automatically installed, and apparently python finds first the older one after i removed 2.6 and its reverse dependencies, the example file n.5 works OK, python finding the wx.aui module in summary, i think that my bug is upstream, either in wxpython or in matplotlib The problem was that matplotlib requires wx2.8, but on debian when both 2.6 and 2.8 are installed, 2.6 is chosed. I sent a patch upstream to convert to import wx together with a way to choose wx2.8 (using wxversion) i understand that from wx import * should work, but it seems that it's not going to work anytime soon with wx2.8 it works as expected. may i suggest that you, speaking as the debian mantainer, could report to matplotlib developers the opportunity of modifying all the wx examples that do the wrong thing when importing wx? they are That's what the patch I forged do. I attached here too, just in case you want to look at and apply it locally. Anyhow, I don't plan an upload to just fix these examples, so this bug will be fixed when upstream will release a new version. Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi Index: examples/user_interfaces/embedding_in_wx2.py === --- examples/user_interfaces/embedding_in_wx2.py (revision 6971) +++ examples/user_interfaces/embedding_in_wx2.py (working copy) @@ -4,6 +4,10 @@ toolbar - comment out the setA_toolbar line for no toolbar +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + from numpy import arange, sin, pi import matplotlib @@ -20,15 +24,15 @@ from matplotlib.figure import Figure -from wx import * +import wx -class CanvasFrame(Frame): +class CanvasFrame(wx.Frame): def __init__(self): -Frame.__init__(self,None,-1, +wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) -self.SetBackgroundColour(NamedColor(WHITE)) +self.SetBackgroundColour(wx.NamedColor(WHITE)) self.figure = Figure() self.axes = self.figure.add_subplot(111) @@ -38,8 +42,8 @@ self.axes.plot(t,s) self.canvas = FigureCanvas(self, -1, self.figure) -self.sizer = BoxSizer(VERTICAL) -self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW) +self.sizer = wx.BoxSizer(wx.VERTICAL) +self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() @@ -49,7 +53,7 @@ def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() -if Platform == '__WXMAC__': +if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -62,8 +66,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. -self.toolbar.SetSize(Size(fw, th)) -self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) +self.toolbar.SetSize(wx.Size(fw, th)) +self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -71,7 +75,7 @@ def OnPaint(self, event): self.canvas.draw() -class App(App): +class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' Index: examples/user_interfaces/embedding_in_wx3.py === --- examples/user_interfaces/embedding_in_wx3.py (revision 6971) +++ examples/user_interfaces/embedding_in_wx3.py (working copy) @@ -18,6 +18,11 @@ Thanks to matplotlib and wx teams for creating such great software! + +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + import sys, time, os, gc
Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
Giacomo Boffi writes: user_interfaces/embedding_in_wx2.py user_interfaces/embedding_in_wx2.py user_interfaces/embedding_in_wx2.py animation/dynamic_image_wxagg2.py the filenames are, of course, ...wx2.py, ...wx3.py and ...wx4.py -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
Hello Giacomo, On Wed, Mar 4, 2009 at 13:00, giacomo boffi bo...@stru.polimi.it wrote: Package: python-matplotlib-doc Version: 0.98.3-5 Severity: normal all the examples about integration between matplotlib and wx applications are broken --- the broken files are /usr/share/doc/python-matplotlib-doc/examples/user_interfaces/embedding_in_wx?.py in particular, items ...wx{2,3,4}.py contain a from wx import * that fails with the error message AttributeError: 'module' object has no attribute '__DocFilter' afaict, that error is well known, and it is recommended to use only import wx in wx applications Mh, there is no reasons why from module import * should not work, and indeed there is a bug already reported about it: #488532 the example ...wx5.py tries to import a module wx.aui that's not found on my system, the error is ImportError: No module named aui thank you This is because the default python wrapper on your machine is v2.6, on 2.8 that module is present: $ ls /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/aui* -1 /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/aui.py /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/aui.pyc I don't think these are bugs in mpl; let me know what you're thinking. Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
Sandro Tosi writes: about --- from wx import * --- Mh, there is no reasons why from module import * should not work, and indeed there is a bug already reported about it: #488532 i have googled around, it seems that this problem was repeatedly reported to distributions and upstream, but never resolved the usual upstream reply is sort of from * import * is bad practice anyway, please do import wx about --- import wx.aui --- This is because the default python wrapper on your machine is v2.6, on 2.8 that module is present: i had both the 2.6 and the 2.8 wrappers, both automatically installed, and apparently python finds first the older one after i removed 2.6 and its reverse dependencies, the example file n.5 works OK, python finding the wx.aui module in summary, i think that my bug is upstream, either in wxpython or in matplotlib i understand that from wx import * should work, but it seems that it's not going to work anytime soon may i suggest that you, speaking as the debian mantainer, could report to matplotlib developers the opportunity of modifying all the wx examples that do the wrong thing when importing wx? they are user_interfaces/embedding_in_wx2.py user_interfaces/embedding_in_wx2.py user_interfaces/embedding_in_wx2.py animation/dynamic_image_wxagg2.py thank you gb -- Mangiate pure le vostre carote, noi mangeremo le nostre salsicce! -- Claud, in IHC -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
Hello Giacomo, On Wed, Mar 4, 2009 at 13:00, giacomo boffi bo...@stru.polimi.it wrote: all the examples about integration between matplotlib and wx applications are broken Is it possible for you to test the package in experimental (0.98.5.2-1) and let me know if the same errors occur with it? I don't have a Debian system at hand, in this moment. Thanks, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#518150: [Python-modules-team] Bug#518150: python-matplotlib-doc: matplotlib 'user_interfaces' wx examples don't work
Sandro Tosi writes: Hello Giacomo, On Wed, Mar 4, 2009 at 13:00, giacomo boffi bo...@stru.polimi.it wrote: all the examples about integration between matplotlib and wx applications are broken Is it possible for you to test the package in experimental (0.98.5.2-1) and let me know if the same errors occur with it? I don't have a Debian system at hand, in this moment. i installed python-matplotlib-doc 0.98.5.2-1 and i tried to run the wx examples: the problem remains, the errors are the same , | boffi95/../user_interfaces Wed Mar 04 17:52:58: python embedding_in_wx2.py | Traceback (most recent call last): | File embedding_in_wx2.py, line 23, in module | from wx import * | AttributeError: 'module' object has no attribute '__DocFilter' | boffi95/../user_interfaces Wed Mar 04 17:53:23: python embedding_in_wx3.py | Traceback (most recent call last): | File embedding_in_wx3.py, line 29, in module | from wx import * | AttributeError: 'module' object has no attribute '__DocFilter' | boffi95/../user_interfaces Wed Mar 04 17:53:30: python embedding_in_wx4.py | Traceback (most recent call last): | File embedding_in_wx4.py, line 19, in module | from wx import * | AttributeError: 'module' object has no attribute '__DocFilter' | boffi95/../user_interfaces Wed Mar 04 17:53:37: python embedding_in_wx5.py | Traceback (most recent call last): | File embedding_in_wx5.py, line 2, in module | import wx.aui | ImportError: No module named aui | boffi95/../user_interfaces Wed Mar 04 17:53:41: ` -- compro mobili vecchi - vendo mobili antichi -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org