Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly install wxPython?

So I was looking around at different things to do on Python, like code for flashing text or a timer, but when I copied them into my window, there were constant syntax errors. Now, maybe you're not meant to copy them straight in, but one error I got was 'no module named wx'. I learned that I could get that module by installing wxPython. Problem is, I've tried all 4 options and none of them have worked for me. Which one do I download and how do I set it up using Windows?

Thanks

like image 700
oisinvg Avatar asked Aug 29 '15 10:08

oisinvg


People also ask

How do you get wxPython?

wxPython can be installed through apt-get by calling apt-get install python-wxgtk2. 8 or apt-get install python-wxgtk2. 6, depending on which version you want. You may have to call this with root permissions.

Does PIP have wxPython?

Starting with wxPython 4.0 (the first Phoenix release) the wxPython source archive and, for supported platforms, wxPython binary wheels are available from the Python Package Index (PyPI). wxPython's project page at PyPI is https://pypi.org/project/wxPython.

Does wxPython work with python3?

The wxPython 4 package is compatible with both Python 2.7 and Python 3.


2 Answers

It's on PyPI. As of wxPython 4, Python 3 is supported.

Unfortunately, PyPI has a package called wx that is stuck at version 3.0.3; be sure to install the package named wxpython instead.

pip install wxpython

Please note that pip will automatically build wxWidgets for you, but it will not install wxWidgets system dependencies such as GTK and OpenGLu. If the above command exits with an error, look above for a message like this:

checking for <something>... not found
checking for <something>... no
configure: error: <prereq> libraries not available
Error running configure
ERROR: failed building widgets

This should give you information about at least one of the packages your system is missing.

The "official" list of prerequisites from the wxWidgets source is:

  • dpkg-dev
  • build-essential
  • libjpeg-dev
  • libtiff-dev
  • libsdl1.2-dev
  • libgstreamer-plugins-base0.10-dev # or 1.0 if available
  • libnotify-dev
  • freeglut3
  • freeglut3-dev
  • libsm-dev
  • libgtk-3-dev
  • libwebkitgtk-3.0-dev # or libwebkit2gtk-4.0-dev if available
  • libxtst-dev

The actual package names provided by your package manager may not match these exactly, and to be honest, I don't really know the best way to query a package manager to determine what packages provide the libraries you need.

like image 199
Kyle Strand Avatar answered Oct 04 '22 07:10

Kyle Strand


3 steps to install wx-widgets and pygame in python IDLE

  1. Install python 3xxx in your system opting (Add 3xxx to your path).
  2. open python CLI to see whether python is working or not.
  3. then open command prompt (CMD).
    • type PIP to see whether pip is installed or not.
  4. enter command : pip install wheel
  5. enter command : pip install pygame
  6. To install wxpython enter command : pip install -U wxPython

Thats all !!

like image 26
sjrk Avatar answered Oct 04 '22 07:10

sjrk