It seems to work on my USB key but I didn’t succeed in making a partition on my mac with the MS-DOT (FAT) Format and because of that I can’t install Ubuntu on this partition. The only thing I’m able to do is to try Ubuntu in my Mac thanks to my USB key but I can’t download folders and softwares on this temporary session.
Ok, this worked for my macOS 10.12.2 / Qt 5.80 / PyQt5.7.1 / sip 4.19 / Python3.5 installation up until step 13.
The file ~/Qt5.3.2/5.3/clang_64/mkspecs/qdevice.pri however did not contain any !host reference and simply adding it myself did not help.
This is a simple example of using the OpenGL Core Profile (aka 'modern' OpenGL) with PyQt, numpy, and PyOpenGL. The DemoCanvas class is a good starting point to explore the demo code. It derives from Canvas which derives from QGLWidget. PyQt is a set of Python bindings developed for Nokia's Qt application framework. Moreover, the PyQt framework runs on all platforms supported by Qt including Mac OS X, Windows and Linux. There are two different sets of bindings: PyQt5 supports Qt v5; and the older PyQt4 supports Qt v4 and earlier. Install Qt Designer on Windows or Mac. Tiny download: Only 40MB! Many people want to use Qt Designer without having to download gigabytes of other software. Here are small, standalone installers of Qt Designer for Windows and Mac. To install PyQt, simply enter the following on the command line. PyQt is often not installed by default. The PyQt module can be used to create desktop applications with Python. In this article you’ll learn how to install the PyQt module. Desktop applications made with PyQt are cross platform, they will work on Microsoft Windows, Apple Mac OS X and Linux computers (including Raspberry Pi). Unfortunately the current version of cxFreeze on Mac OS X does not play particularly nicely with Python versions that have been installed from Python.org or PyQt if you have installed it previously using our instructions. Therefore, to ensure that cxFreeze installs successfully you will need to install Python and PyQt using a package manager.
Then I found this post on Stack Overflow. It stated I should run:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
which worked like a charm all the way up to step 15.
During step 15 however, I received the error:
This is the GPL version of PyQt 5.7.1 (licensed under the GNU General Public
License) for Python 3.5.3 on darwin. Error: This version of PyQt5 and the commercial version of Qt have incompatible licenses.
I was able to fix that error by commenting out some lines in PyQt5 configure.py as instructed here.
Then, I continued and the command from step 15 executed without a problem.
However, now, when I run make (step 16) I am receiving this error:
~/Downloads/PyQt5_gpl-5.7.1/QtCore/sipQtCoreQt.cpp:1093:62: error: no member named 'WindowCancelButtonHint' in namespace 'Qt'; did you mean
'WindowCloseButtonHint'?
{sipName_WindowCancelButtonHint, static_cast( ::Qt::WindowCancelButtonHint), 419},
~~~~~~^~~~~~~~~~~~~~~~~~~~~~
WindowCloseButtonHint
./././Qt5.8.0/5.8/clang_64/lib/QtCore.framework/Headers/qnamespace.h:300:9: note: 'WindowCloseButtonHint' declared here
WindowCloseButtonHint = 0x08000000,
^
~/Downloads/PyQt5_gpl-5.7.1/QtCore/sipQtCoreQt.cpp:1106:58: error: no member named 'WindowOkButtonHint' in namespace 'Qt'
{sipName_WindowOkButtonHint, static_cast( ::Qt::WindowOkButtonHint), 419},
~~~~~~^
2 errors generated.
make[1]: *** [sipQtCoreQt.o] Error 1
make: *** [sub-QtCore-make_first-ordered] Error 2
Does anyone have any idea how to fix this?
- PyQt Tutorial
- PyQt Useful Resources
- Selected Reading
PyQt is a GUI widgets toolkit. It is a Python interface for Qt, one of the most powerful, and popular cross-platform GUI library. PyQt was developed by RiverBank Computing Ltd. The latest version of PyQt can be downloaded from its official website − riverbankcomputing.com
PyQt API is a set of modules containing a large number of classes and functions. While QtCore module contains non-GUI functionality for working with file and directory etc., QtGui module contains all the graphical controls. In addition, there are modules for working with XML (QtXml), SVG (QtSvg), and SQL (QtSql), etc.
Supporting Environments
PyQt is compatible with all the popular operating systems including Windows, Linux, and Mac OS. It is dual licensed, available under GPL as well as commercial license.
Windows
You can download and install an appropriate installer from the above download link corresponding to Python version (2.7 or 3.4) and hardware architecture (32 bit or 64 bit). Note that there are two versions of PyQt that are available namely, PyQt 4.8 and PyQt 5.5.
Metropolitan theme excel for mac. You can minimize the effects of sandboxing by using the new commands described in the following section.
While PyQt4 is available for Python 2 as well as Python 3, PyQt5 can be used along with Python 3.* only.
PyQt4 Windows Binaries
PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64.exe | Windows 64 bit installer |
PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x32.exe | Windows 32 bit installer |
PyQt4-4.11.4-gpl-Py3.4-Qt5.5.0-x64.exe | Windows 64 bit installer |
PyQt4-4.11.4-gpl-Py3.4-Qt5.5.0-x32.exe | Windows 32 bit installer |
PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x64.exe | Windows 64 bit installer |
PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32.exe | Windows 32 bit installer |
PyQt5 Windows Binaries
Pyqt Designer Mac
PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x64.exe | Windows 64 bit installer |
PyQt5-5.5-gpl-Py3.4-Qt5.5.0-x32.exe | Windows 32 bit installer |
Linux
For Ubuntu or any other debian Linux distribution, use the following command to install PyQt −
You can also build from the source code available on the ‘download’ page.
PyQt-x11-gpl-4.11.4.tar.gz | Linux, UNIX source for PyQt4 |
PyQt-gpl-5.5.tar.gz | Linux, UNIX, MacOS/X source for PyQt5 |
Mac OS
PyQtX project (http://sourceforge.net/projects/pyqtx/) hosts binaries of PyQt for Mac. Use Homebrew installer as per the following command −
Creating self-contained applications on Mac OS X is not quite as straight-forward as it is on Windows but as long as you follow the guidance below all will be okay.
Python and PyQt
Unfortunately the current version of cx_Freeze on Mac OS X does not play particularly nicely with Python versions that have been installed from Python.org or PyQt if you have installed it previously using our instructions. Therefore, to ensure that cx_Freeze installs successfully you will need to install Python and PyQt using a package manager called MacPorts.
Thankfully, the MacPorts installation of Python and PyQt is separate from your existing installation so you do not* need to remove any files before you start.
MacPorts
MacPorts is a package manager for Mac OS X which is designed to make working with tools that are predominated Unix based much easier. If you have ever used a Linux distribution then you will be familiar with the concept and MacPorts works in the same way. It removes all of the hassle of compiling, maintaining and updating these tools and allows you to focus on just using them. Download vmware horizon for mac.
Install Pyqt Designer
Installing MacPorts
To install MacPorts you will need to do the following:
- Ensure that you have the latest version of XCode installed (available from the Mac App Store)
- From within XCode install the command line tools
- XCode menu -> Preferences -> Downloads
- Download the pkg installer of MacPorts for your version of Mac OS X:
- Run the downloaded installer for MacPorts
Using MacPorts to install Python and PyQt
MacPorts is a command line utility, which means that you will need to use the Terminal application to interact with it.
Open terminal and enter the following commands one at a time. Ensure you press enter after each command. When entering commands prefaced by sudo you may be asked for your password:
sudo port selfupdate
- this updates MacPorts to the latest versionsudo port install py33-pyqt4
- this installs Python 3.3 and PyQt4sudo port install py33-tkinter
- this installs required libraries to run IDLE
Python and PyQt should now be installed, test this out by doing the following:
- Open Applications/MacPorts/Python3.3/IDLE
- In the Python Shell type:
from PyQt4.QtGui import *
If there are no error messages then PyQt4 has been successfully installed.
Adding a missing library
There is another library that cx_Freeze requires to function correctly on Mac called libintl, we must install this first. Without it, any attempts to use cx_Freeze will fail.
Download the libintl library package:
- Run the package installer to install the library
Installing cx_Freeze
cx_Freeze is a utility that will take your Python program and convert it to a stand-alone application (.app) file that can be run on any Mac computer.
Getting the source
Before we can install cx_Freeze we need the source code:
If the link is broken try the cx_Freeze homepage:
Installing from source
Now that you have the source code you will need to build and install cx_Freeze. To do this you will need to make use of the Terminal application.
The video below demonstrates this.
Task
Use the above video to install cx_Freeze from the source code you have downloaded.
Creating a script for cx_Freeze
To create a stand-alone application from your program cx_Freeze needs a script to tell it what to do. Because our programs are fairly simple (in the grand scheme of things) all we need to do is make a few changes to the sample program that is provided by cx_Freeze for use with PyQt programs.
The sample script has two lines that we are interested in:
application_title = 'simple_PyQt4'
main_python_file = 'PyQt4app.py'
You should change the values assigned to the variables application_title
and main_python_file
so that they are suitable for whatever program you wish to create a stand-alone application for. For example, the field simulation would be:
application_title = 'Field Simulation'
main_python_file = 'field_simulation.py'
Once you have made the necessary changes save the script and then move it so that it is in the same directory as the Python modules you want to convert to a stand-alone application.
Run the cx_Freeze script
The final step of this process is to execute the cx_Freeze script. The video demonstrates how to do this.
Task
Use the above video to create a stand-alone application.
Final thoughts
In this section you have see how to turn your Python program into a stand-alone application that you can distribute to other people. To do this we modified an example script to get cx_Freeze to perform the necessary operations for us. However, if your application was more complex you may need to modify the script further. The documentation for cx_Freeze should be able to point you in the right direction and there is an excellent mailing list that you can join to get assistance as well.
- Previous - Distributing your application
- Next - Distributing your application on Windows