Here is backend_wx.py
https://pastebin.com/0bHs4rY5

from
~/.virtualenvs/pypy-nightly-trunk/site-packages/matplotlib-2.1.0rc1+112.
g17ec41612.dirty-py2.7-linux-x86_64.egg/matplotlib/backends/backend_wx.py


Around line 1818 there is a mix of tabs and spaces, which doesn't seem right.
Also  "class PrintoutWx(wx.Printout):" appears more than once.



I'm using the method from that webpage, the only change is I added "sudo" and "-y" to the apt-get line.

I used my script to grab pypy nightly:
https://gist.github.com/stuaxo/5d4c0363317a875617271a6d424abbba

activated the virtualenv it created for trunk
$ source ~/.virtualenvs/pypy-nightly-trunk/bin/activate

Then ran the script - pointing at the virtualenv
$ ./build_wx-cffi.sh $VIRTUAL_ENV


I noticed this error when building:

doc
"/mnt/data/home/stu/.virtualenvs/pypy-nightly-trunk/bin/pypy" etg/grid.py --cffi --nodoc
Traceback (most recent call last):
  File "etg/grid.py", line 392, in <module>
    run()
  File "etg/grid.py", line 387, in run
    tools.runGenerators(module)
  File "/tmp/t/wxpython-cffi/etgtools/tweaker_tools.py", line 636, in runGenerators
    g.generate(module)
  File "/tmp/t/wxpython-cffi/etgtools/pi_generator.py", line 52, in generate
    self.generateModule(module, stream)
  File "/tmp/t/wxpython-cffi/etgtools/pi_generator.py", line 149, in generateModule
    function(item, stream)
  File "/tmp/t/wxpython-cffi/etgtools/pi_generator.py", line 365, in generateClass
    bases = [self.fixWxPrefix(b, True) for b in bases]
  File "/tmp/t/wxpython-cffi/etgtools/tweaker_tools.py", line 96, in fixWxPrefix
    self._getCoreTopLevelNames()
  File "/tmp/t/wxpython-cffi/etgtools/tweaker_tools.py", line 133, in _getCoreTopLevelNames
    parseTree = ast.parse(text, filename)
  File "/home/stu/pypy-nightly/trunk/pypy-c-jit-latest-linux64/lib-python/2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "wx/core.pi", line 27712
    def operator==():


I can't paste the whole compile output on pastebin as it is > 512k
On Saturday, September 30, 2017, 8:56:48 PM GMT+1, Matti Picus <matti.picus@gmail.com> wrote:


On 30/09/17 03:32, Stuart Axon via pypy-dev wrote:

Cheers for the suggestons on TKinter and matplotlib -

mplcairo is out, since it uses pycairo (as opposed to cairocffi). 

Wx-CFFI looks interesting, however all the matplotlib tutorials give me errors like the one below, so that is probably out as well for now - I'll definitely keep an eye on it and see it starts working though.


$ python pyplot.py
/home/stu/.virtualenvs/pypy-nightly-trunk/site-packages/wx/core.py:17: UserWarning: wxPython/wxWidgets release number mismatch
  warnings.warn("wxPython/wxWidgets release number mismatch")
/home/stu/.virtualenvs/pypy-nightly-trunk/site-packages/wx/_core.py:31546: UserWarning: implicit cast from 'unsigned char *' to 'char *' will be forbidden in the future (check that the types are as you expect; use an explicit ffi.cast() if they are correct)
  clib.Cursor_set_flags(wrapper_lib.get_ptr(self), flags)
Traceback (most recent call last):
  File "pyplot.py", line 38, in <module>
    import matplotlib.pyplot as plt
  File "/home/stu/.virtualenvs/pypy-nightly-trunk/site-packages/matplotlib-2.1.0rc1+110.g963f91300.dirty-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 113, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/stu/.virtualenvs/pypy-nightly-trunk/site-packages/matplotlib-2.1.0rc1+110.g963f91300.dirty-py2.7-linux-x86_64.egg/matplotlib/backends/__init__.py", line 60, in pylab_setup
    [backend_name], 0)
  File "/home/stu/.virtualenvs/pypy-nightly-trunk/site-packages/matplotlib-2.1.0rc1+110.g963f91300.dirty-py2.7-linux-x86_64.egg/matplotlib/backends/backend_wxagg.py", line 12, in <module>
    from . import backend_wx
  File "/home/stu/.virtualenvs/pypy-nightly-trunk/site-packages/matplotlib-2.1.0rc1+110.g963f91300.dirty-py2.7-linux-x86_64.egg/matplotlib/backends/backend_wx.py", line 1818
SyntaxError: return outside function



That seems like a strange syntax error, since backend_wx.py is used in the standard matplotlib (non-pypy) which is green on their buildbot.

if you are using the method here
https://pythonfiles.wordpress.com/2017/06/28/making-matplotlib-work-with-pypy/
perhaps it just needs a bit of tweaking for newer versions of backend_wx

Could you post your backend_wx.py to a pastebin or gist so we can reproduce?
Matti