Holy Cow Python 2.7/wxPython/wxGlade Install!

I started back into my work on Python CNC as the Bozeman Makerspace has a Shapeoko that my son wants to learn to use.

I looked at a bunch of software packages and feel there is a need for a simple SVG based drawing program that has direct g-code output.  Sure you can use a plugin in Inkscape and there is jscut but I want something that is a little parametric.  I imagine a program with a list of shapes on the right where you can link a milling function to each with a graphical display of the tool paths on the right.

This is based on my own process and the tools I used to mill on my Bridgeport CNC.  I started with a CAD drawing and then built code from the drawing with my own Python objects.  Then after outputing the g-code I would import it into NCplot to verify the tool paths.  Then off to EMC2, now known as LinuxCNC, to run in air first and then on a test piece.

For the Shapeoko the process is similar:

  • SVG in Inkscape
  • Load it in jscut
  • Output the g-code
  • Load it in GRBL
  • Cut in air first and then on a test piece.


Here is an example:



So I am looking into Python GUI again and wanted to build on some work I did with Python and wxPython,  I used a pretty neat little GUI editor called wxGlade,  and had some success building an interface with the blaa icon package.

Since wxGlade lets you mock up a GUI and outputs the code in wxPython, I wanted to use the package again.  However, since I last worked with wxGlade I upgraded my computer from Windows XP to Win 8.1 and I wondered if it would even work.

So here was my installations on the new computer.

Python 2.7.9, 32 bit - Found at https://www.python.org/downloads/windows/
wxPython, 3.0, 32 bit - Found at http://sourceforge.net/projects/wxpython/
wxGlade 0.7.0, - Found at http://wxglade.sourceforge.net/index.php#download

For graphics I installed pyOpenGL which does not require a download if you can get pip to work.

wxGlade

My first problem with this setup was getting wxGlade to open.  When the installation finished I checked the box, Open wxGlade, and waited.  Nothing happened.

I searched for the fix for this issue for a while and finally gave up.  However, right clicking on the wxGlade icon and clicking Properties allowed me to see that the shortcut was running the Python.exe executable and the actual path that Python ran was:
    "C:\Program Files (x86)\wxGlade\wxglade.pyw".

So I opened the Command Prompt and changed to that directory.  Then ran:
    python wxglade.pyw

I got an error:
IOError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Roam
ing\\wxglade\\wxglade.log'.

So I simply created a folder and file with that name and then wxGlade opened without issue.  I don't know why this wasn't installed normally in Windows 8.1 but it worked so I will document it here.

pyOpenGL

The next issue was with the installation of pyOpenGL with pip,

 First of all you need to run pip in a Windows Command Prompt and NOT the Python shell.

However, when I ran it I would get an error "Unable to find vcvarsall.bat" and a bunch of failure text.

So I found this post on StackOverflow: pip install gives error: Unable to find vcvarsall.bat

It seems to use pip, and possibly other Python functions, you need a copy of a the Microsoft Visual C++ Compiler for Python 2.7. Kudos to Broccoli Soup for that post as I think most people responding were overthinking the complexity of the question... for me at least.   After downloading and installing the package, pip worked just fine.

On a hunch I also installed Numpy by simply typing:
pip install Numpy.

It seemed to work but I need to test it before I trust the installation.

I will post more about wxGlade as I get something new to show.

Comments

Popular posts from this blog

Maintenance of a 30 Year Old CNC Milling Machine

DIY CNC Milling Machine Control Panel for EMC2

Power Supply for CNC