-
Notifications
You must be signed in to change notification settings - Fork 39
PyQt5
You can use Qt5 based GUI widgets in your pyORBIT scripts. It will require matplotlib and PyQt5 installation.
-
Install Xcode, launch it, agree to all license agreements (! Important)
-
Install the latest version of macports.
This guide is known to work for following OS/port combinations
Mac OS version MacPorts version Sierra 10.12 2.5.3 Mojave 10.14.4 2.5.4 -
Run port
sudo port install python27 py27-matplotlib py27-pyqt5
-
Select python27
sudo port select --set python python27
-
Download a test file and make sure that it works with python
curl -o test-qt.py https://matplotlib.org/_downloads/embedding_in_qt_sgskip.py python test-qt.py
If the script fails, try replacing
super().__init__()
with
super(ApplicationWindow,self).__init__()
in test-qt.py and run again.
-
Reinstall pyORBIT, this is needed to compile it with correct python headers/libraries.
-
Try running the same test-qt.py with pyORBIT
$ORBIT_ROOT/bin/pyORBIT test-qt.py
-
Install required packages
yum groupinstall 'Development Tools' 'X Window System' yum install qt5-qtbase qt5-qtbase-devel python-devel epel-release yum install python-pip
-
sip-4.19.7 and PyQt5_gpl-5.10 are known to work. Some newer versions are known to produce installation errors.
-
Install sip
cd sip-4.19.7 python configure.py make make install cd ..
-
Install PyQt5
cd PyQt5_gpl-5.10 python configure.py --qmake /usr/bin/qmake-qt5 make make install cd ..
-
Install matplotlib
pip install --upgrade pip pip install -U matplotlib
-
Try standard example with matplotlib (should draw nice plots).
curl -o test-qt.py https://matplotlib.org/_downloads/embedding_in_qt_sgskip.py python test-qt.py
If the script fails, try replacing
super().__init__()
with
super(ApplicationWindow,self).__init__()
in test-qt.py and run again.
-
Proceed with pyORBIT installation as usual.
-
Try to run the same test-qt.py script with pyORBIT executable
$ORBIT_ROOT/bin/pyORBIT test-qt.py
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as pltAlternatively you can set an environment variable (and maybe put it in setupEnvironment.sh of your pyORBIT installation). More details are provided here.
export MPLBACKEND="Qt5Agg"