Written by Cyrille Fauvel – Autodesk Developer Network (April 2013)
Updated by Vijaya Prakash – Autodesk Developer Network (November 2016)
Chengxi Li - Autodesk Developer Network (June 2017)
Building SIP, and PyQt for Maya 2017 PyQt [https://www.riverbankcomputing.co.uk] is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt website for information about licensing for PyQt.
Download PyQt: https://www.riverbankcomputing.com/software/pyqt/download
Download SIP: https://www.riverbankcomputing.com/software/sip/download
The following are instructions for building a copy of the PyQt modules that have been known to work with Maya.
Maya 2017 uses Qt5.6.1 which is binary compatible with the latest version of PyQt – 5.7 / SIP - 4.18.1
Note that it’s important to use the Maya modified version of the Qt source code. A copy of the customized Qt 5.6.1 source is available from Autodesk's Open Source web-site (https://www.autodesk.com/lgplsource) and includes text files describing how to configure, build and install Qt for each platform supported by Maya.
However, be aware that with Maya 2017, there is no more need to build PySide as it is coming by default in Maya, nor you have to rebuild Qt itself as the main Qt tools to build PyQt are now included in the Maya distributions (I.e. qmake, moc, …)
libxml, openSSL, OpenAL, python2.7, qt-5.6.1, and tbb are also coming by default in the Maya include and lib folders, so unless you have a very specific need, you would not need to rebuild any of those libraries like before. Note as well that there is a 'MAYA_LOCATION/support/opensource' folder now which contains some of the community source.
Important: Maya 2017 now ships without the devkit, include and mkspecs folders. You can get the Maya 2017 devkit from the Autodesk App Store here for Windows, OSX, and Linux. Download the devkit and unzip the files into your Maya root folder. Make sure to read the instructions to install the devkit, include and mkspecs folders properly on your system.
The scripts used in this document are now also posted on Github.
Download SIP and PyQt source from 'https://www.riverbankcomputing.co.uk' - here I downloaded 'sip- 4.18.1' and 'PyQt5_gpl-5.7'. Unzip them in one folder, then you should get something like this:
/Users/cyrille/Documents/_Maya2017Scripts/sip-4.18.1
/Users/cyrille/Documents/_Maya2017Scripts/PyQt5_gpl-5.7 '
/Users/cyrille/Documents/_Maya2017Scripts' being my local folder.
Here are the instructions and scripts for building SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Mac OS X environment, in the Maya Documentation)
If you would like to use Xcode 6.1.1 to compile it and you are having multiple installation of Xcode. Please backup /Applications/Xcode.app and use Xcode 6.1.1 to replace it. You can restore it after installation.
Note that Xcode 6.1.1 won't open on Mac OS X Sierra(10.12), but it is still able to build PyQt5.
Use xcode-select to change active xcode like below:
The qt.conf file uses MAYA_LOCATION and DEVKIT_LOCATION to locate the expected header/library files. Therefore, users must set both environment variables before building the PyQt5.
DEVKIT_LOCATION should point to the directory where the devkit include, mkspecs, cmake directories are located.
Modify devkit/bin/qt.conf as below:
Untar the qt-5.6.1-mkspecs.tar.gz into /Applications/Autodesk/maya2017/mkspecs. Make sure the qconfig.pri looks like this:
qconfig.pri
You're done! Please check the testing paragraph at the end of the article.
/home/cyrille/Documents/_Maya2017Scripts/sip-4.18.1
/home/cyrille/Documents/_Maya2017Scripts/PyQt5_gpl-5.7
'/home/cyrille/Documents/_Maya2017Scripts' being my local folder.
Here are the instructions and scripts for building SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Linux environments (64 bit), in the Maya Documentation).
The qt.conf file uses MAYA_LOCATION and DEVKIT_LOCATION to locate the expected header/library files. Therefore, users must set both environment variables before building the PyQt5.
DEVKIT_LOCATION should point to the directory where the devkit include, mkspecs, cmake directories are located.
Please backup your qt.conf first, you'll need to restore it after building PyQt5. Replace …/bin/qt.conf with below:
Untar the /mkspecs/qt-5.6.1-mkspecs.tar.gz into /mkspecs
Make qmake, moc executables from the Maya bin directory
D:\__sdkext\_Maya2017 Scripts\sip-4.18.1
D:\__sdkext\_Maya2017 Scripts\PyQt5_gpl-5.7
D:\__sdkext\_Maya2017 Scripts being my local folder.
Here are the instructions and scripts for building SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Windows environment (64-bit), in the Maya Documentation)
Please backup your qt.conf first, you'll need to restore it after building PyQt5. Replace …/bin/qt.conf with below:
Unzip the /include/qt-5.6.1-include.tar.gz into /include/Qt
Unzip the /mkspecs/qt-5.6.1-mkspecs.tar.gz into /mkspecs
Please run following build scripts with VS2012 x64 Native Tools Command Prompt. If your Maya installed in folders required administrator privilege(e.g. Program files), please run the command prompt as Administrator.
You're done! Please check the testing paragraph at the end of the article.
Updated by Vijaya Prakash – Autodesk Developer Network (November 2016)
Chengxi Li - Autodesk Developer Network (June 2017)
Building SIP, and PyQt for Maya 2017 PyQt [https://www.riverbankcomputing.co.uk] is a python binding to the Qt library. Because Maya uses Qt internally, you can use the PyQt modules in Maya python scripts to create custom UI. PyQt does not have the same licensing as Maya, Qt, or Python. Please consult the PyQt website for information about licensing for PyQt.
Download PyQt: https://www.riverbankcomputing.com/software/pyqt/download
Download SIP: https://www.riverbankcomputing.com/software/sip/download
The following are instructions for building a copy of the PyQt modules that have been known to work with Maya.
Maya 2017 uses Qt5.6.1 which is binary compatible with the latest version of PyQt – 5.7 / SIP - 4.18.1
Note that it’s important to use the Maya modified version of the Qt source code. A copy of the customized Qt 5.6.1 source is available from Autodesk's Open Source web-site (https://www.autodesk.com/lgplsource) and includes text files describing how to configure, build and install Qt for each platform supported by Maya.
However, be aware that with Maya 2017, there is no more need to build PySide as it is coming by default in Maya, nor you have to rebuild Qt itself as the main Qt tools to build PyQt are now included in the Maya distributions (I.e. qmake, moc, …)
libxml, openSSL, OpenAL, python2.7, qt-5.6.1, and tbb are also coming by default in the Maya include and lib folders, so unless you have a very specific need, you would not need to rebuild any of those libraries like before. Note as well that there is a 'MAYA_LOCATION/support/opensource' folder now which contains some of the community source.
Important: Maya 2017 now ships without the devkit, include and mkspecs folders. You can get the Maya 2017 devkit from the Autodesk App Store here for Windows, OSX, and Linux. Download the devkit and unzip the files into your Maya root folder. Make sure to read the instructions to install the devkit, include and mkspecs folders properly on your system.
The scripts used in this document are now also posted on Github.
Download SIP and PyQt source from 'https://www.riverbankcomputing.co.uk' - here I downloaded 'sip- 4.18.1' and 'PyQt5_gpl-5.7'. Unzip them in one folder, then you should get something like this:
Mac
/Users/cyrille/Documents/_Maya2017Scripts/sip-4.18.1
/Users/cyrille/Documents/_Maya2017Scripts/PyQt5_gpl-5.7 '
/Users/cyrille/Documents/_Maya2017Scripts' being my local folder.
Here are the instructions and scripts for building SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Mac OS X environment, in the Maya Documentation)
If you would like to use Xcode 6.1.1 to compile it and you are having multiple installation of Xcode. Please backup /Applications/Xcode.app and use Xcode 6.1.1 to replace it. You can restore it after installation.
Note that Xcode 6.1.1 won't open on Mac OS X Sierra(10.12), but it is still able to build PyQt5.
Use xcode-select to change active xcode like below:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
The qt.conf file uses MAYA_LOCATION and DEVKIT_LOCATION to locate the expected header/library files. Therefore, users must set both environment variables before building the PyQt5.
DEVKIT_LOCATION should point to the directory where the devkit include, mkspecs, cmake directories are located.
Modify devkit/bin/qt.conf as below:
[Paths]Untar the include/qt-5.6.1-include.tar.gz into /include/Qt
Prefix=
Libraries=$(MAYA_LOCATION)/MacOS
Binaries=$(DEVKIT_LOCATION)/devkit/bin
Headers=$(DEVKIT_LOCATION)/include/Qt
ArchData=$(DEVKIT_LOCATION)
Data=$(DEVKIT_LOCATION)
HostData=$(DEVKIT_LOCATION)
HostBinaries=$(DEVKIT_LOCATION)/devkit/bin
HostLibraries=$(MAYA_LOCATION)/MacOS
Untar the qt-5.6.1-mkspecs.tar.gz into /Applications/Autodesk/maya2017/mkspecs. Make sure the qconfig.pri looks like this:
qconfig.pri
#configuration
CONFIG += release def_files_disabled exceptions no_mocdepend stl x86_64 qt #qt_framework
QT_ARCH = macosx
QT_EDITION = OpenSource
QT_CONFIG += minimal-config small-config medium-config large-config full-config no-pkg-config dwarf2 phonon phonon-backend accessibility opengl reduce_exports ipv6 getaddrinfo ipv6ifname getifaddrs png no-freetype system-zlib nis cups iconv openssl corewlan concurrent xmlpatterns multimedia audio-backend svg script scripttools declarative release x86_64 qt #qt_framework
#versioning
QT_VERSION = 5.6.1
QT_MAJOR_VERSION = 5
QT_MINOR_VERSION = 6
QT_PATCH_VERSION = 1
#namespaces
QT_LIBINFIX =
QT_NAMESPACE =
QT_NAMESPACE_MAC_CRC =
Build & Install SIP
Please use the script below, you can also find it in GitHub.#!/usr/bin/env bash
MAYAQTBUILD="`dirname \"$0\"`" # Relative
export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized
pushd $MAYAQTBUILD
export SIPDIR=$MAYAQTBUILD/sip-4.18.1
export MAYA_LOCATION=/Applications/Autodesk/maya2017
pushd $SIPDIR
$MAYA_LOCATION/Maya.app/Contents/bin/mayapy ./configure.py --arch=x86_64
make
sudo make install
popd
popd
Build & Install PyQt
Please use the script below, you can also find it in GitHub.#!/usr/bin/env bashNote that I am compiling against Mac OS X SDK 10.9 which is same as the developer environment. If you want to compile against other versions, please modify the script(macosx10.9).
MAYAQTBUILD="`dirname \"$0\"`" # Relative
export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized
pushd $MAYAQTBUILD
export MAYA_LOCATION=/Applications/Autodesk/maya2017/Maya.app/Contents
export DEVKIT_LOCATION=/Applications/Autodesk/maya2017
export QTDIR=$DEVKIT_LOCATION/devkit
export QMAKESPEC=$DEVKIT_LOCATION/mkspecs/macx-clang
export INCDIR_QT=$DEVKIT_LOCATION/include/Qt
export LIBDIR_QT=$MAYA_LOCATION/MacOS
error=0
if [ ! -f $QMAKESPEC/qmake.conf ];
then
echo "You need to install qt-5.6.1-mkspecs.tar.gz in $QTDIR/mkspecs !"
error=1
fi
if [ ! -f $INCDIR_QT/QtCore/qdir.h ];
then
echo "You need to uncompress $MAYA_LOCATION/devkit/include/qt-5.6.1-include.tar.gz in $INCDIR_QT !"
error=1
fi
# qt.conf - /Applications/Autodesk/maya2017/Maya.app/Contents/Resources
if [ ! -f $QTDIR/bin/qt.conf ];
then
echo "You need to copy $QTDIR/Resources/qt.conf in $QTDIR/bin !"
error=1
fi
test=`grep 'Data=$(DEVKIT_LOCATION)' $QTDIR/bin/qt.conf`
if [ -z "$test" ];
then
echo "You need to edit $QTDIR/bin/qt.conf to use 'Data=\$(DEVKIT_LOCATION)'"
error=1
fi
test=`grep 'Headers=$(DEVKIT_LOCATION)/include/Qt' $QTDIR/bin/qt.conf`
if [ -z "$test" ];
then
echo "You need to edit $QTDIR/bin/qt.conf to use 'Headers=\$(DEVKIT_LOCATION)/include/Qt'"
error=1
fi
test=`grep 'Libraries=$(MAYA_LOCATION)/MacOS' $QTDIR/bin/qt.conf`
if [ -z "$test" ];
then
echo "You need to edit $QTDIR/bin/qt.conf to use 'Libraries=\$(MAYA_LOCATION)/MacOS'"
error=1
fi
if [ $error -eq 1 ];
then
exit
fi
export DYLD_LIBRARY_PATH=$MAYA_LOCATION/MacOS
export DYLD_FRAMEWORK_PATH=$MAYA_LOCATION/Frameworks
export SIPDIR=$MAYAQTBUILD/sip-4.18.1
export PYQTDIR=$MAYAQTBUILD/PyQt5_gpl-5.7
export SIP_EXE=$MAYA_LOCATION/Frameworks/Python.framework/Versions/2.7/bin/sip
export SIP_INCLUDE=$MAYA_LOCATION/Frameworks/Python.framework/Versions/2.7/include/python2.7
pushd $PYQTDIR
export PATH=$QTDIR/bin:$PATH
echo
echo Environment
echo -----------
set
echo -----------
echo QT Settings
echo -----------
qmake -query
echo -----------
echo
$MAYA_LOCATION/bin/mayapy ./configure.py QMAKE_MAC_SDK=macosx10.9 QMAKE_RPATHDIR+=$LIBDIR_QT --sip=$SIP_EXE --sip-incdir=$SIP_INCLUDE -w --no-designer-plugin
make -j 8
sudo make install
popd
popd
You're done! Please check the testing paragraph at the end of the article.
Linux
/home/cyrille/Documents/_Maya2017Scripts/sip-4.18.1
/home/cyrille/Documents/_Maya2017Scripts/PyQt5_gpl-5.7
'/home/cyrille/Documents/_Maya2017Scripts' being my local folder.
Here are the instructions and scripts for building SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Linux environments (64 bit), in the Maya Documentation).
The qt.conf file uses MAYA_LOCATION and DEVKIT_LOCATION to locate the expected header/library files. Therefore, users must set both environment variables before building the PyQt5.
DEVKIT_LOCATION should point to the directory where the devkit include, mkspecs, cmake directories are located.
Please backup your qt.conf first, you'll need to restore it after building PyQt5. Replace …/bin/qt.conf with below:
[Paths]Untar the /include/qt-5.6.1-include.tar.gz into /include/Qt
Prefix=
Libraries=$(MAYA_LOCATION)/lib
Binaries=$(DEVKIT_LOCATION)/bin
Headers=$(DEVKIT_LOCATION)/include/Qt
ArchData=$(DEVKIT_LOCATION)
Data=$(DEVKIT_LOCATION)
HostData=$(DEVKIT_LOCATION)
HostBinaries=$(DEVKIT_LOCATION)/bin
Untar the /mkspecs/qt-5.6.1-mkspecs.tar.gz into /mkspecs
Make qmake, moc executables from the Maya bin directory
sudo chmod aog+x /usr/autodesk/maya2017/bin/moc
sudo chmod aog+x /usr/autodesk/maya2017/bin/qmake
Build & Install SIP
Please use the script below, you can also find it in GitHub.#!/usr/bin/env bash
MAYAQTBUILD="`dirname \"$0\"`" # Relative
export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized
pushd $MAYAQTBUILD
export SIPDIR=$MAYAQTBUILD/sip-4.18.1
export MAYA_LOCATION=/usr/autodesk/maya2017
pushd $SIPDIR
$MAYA_LOCATION/bin/mayapy ./configure.py
make
sudo make install
popd
popd
Build & Install PyQt
Please use the script below, you can also find it in GitHub.#!/usr/bin/env bashYou're done! Please check the testing paragraph at the end of the article.
MAYAQTBUILD="`dirname \"$0\"`" # Relative
export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized
pushd $MAYAQTBUILD
export MAYA_LOCATION=/usr/autodesk/maya2017
export QTDIR=$MAYA_LOCATION
export DEVKIT_LOCATION=$MAYA_LOCATION
export QMAKESPEC=$QTDIR/mkspecs/linux-g++-64
export INCDIR_QT=$MAYA_LOCATION/include/Qt
export LIBDIR_QT=$QTDIR/lib
error=0
if [ ! -f $QMAKESPEC/qmake.conf ];
then
echo "You need to install qt-5.6.1-mkspecs.tar.gz in $QTDIR/mkspecs !"
error=1
fi
if [ ! -f $INCDIR_QT/QtCore/qdir.h ];
then
echo "You need to uncompress $MAYA_LOCATION/include/qt-5.6.1-include.tar.gz in $INCDIR_QT !"
error=1
fi
# qt.conf - $QTDIR/bin/qt.conf
if [ ! -f $QTDIR/bin/qt.conf ];
then
echo "You need to copy $QTDIR/Resources/qt.conf in $QTDIR/bin !"
error=1
fi
# The grep string should be in single quote('), if it is in double quote (""),
# shell will expand the variable, hence the intension of the below grep will fail
test=`grep 'Headers=$(DEVKIT_LOCATION)/include/Qt' $QTDIR/bin/qt.conf`
if [ -z "$test" ];
then
echo "You need to edit $QTDIR/bin/qt.conf to use 'Headers=$(DEVKIT_LOCATION)/include/Qt'"
error=1
fi
if [ $error -eq 1 ];
then
exit
fi
export SIPDIR=$MAYAQTBUILD/sip-4.18.1
export PYQTDIR=$MAYAQTBUILD/PyQt5_gpl-5.7
pushd $PYQTDIR
export PATH=$QTDIR/bin:$PATH
$QTDIR/bin/mayapy ./configure.py LIBDIR_QT=$LIBDIR_QT INCDIR_QT=$INCDIR_QT MOC=$QTDIR/bin/moc -w --no-designer-plugin
make -j 8
sudo make install
popd
popd
Windows
D:\__sdkext\_Maya2017 Scripts\sip-4.18.1
D:\__sdkext\_Maya2017 Scripts\PyQt5_gpl-5.7
D:\__sdkext\_Maya2017 Scripts being my local folder.
Here are the instructions and scripts for building SIP and PyQt.
Follow the instructions from the API docs to setup your environment (Developer Resources > API Guide > Setting up your build environment > Windows environment (64-bit), in the Maya Documentation)
Please backup your qt.conf first, you'll need to restore it after building PyQt5. Replace …/bin/qt.conf with below:
[Paths]
Prefix=$(MAYA_LOCATION)
Libraries=lib
Binaries=bin
Headers=include/Qt
Data=.
Plugins=qt-plugins
Translations=qt-translations
Qml2Imports=qml
Unzip the /include/qt-5.6.1-include.tar.gz into /include/Qt
Unzip the /mkspecs/qt-5.6.1-mkspecs.tar.gz into /mkspecs
Please run following build scripts with VS2012 x64 Native Tools Command Prompt. If your Maya installed in folders required administrator privilege(e.g. Program files), please run the command prompt as Administrator.
Environment Setup
@echo off
set MAYAVERSION=2017
set ADSKQTVERSION=5.6.1
set SIPVERSION=4.18.1
set PYQTVERSION=5.7
set MAYADRIVE=m:
set BUILDDRIVE=v:
if exist %MAYADRIVE%\nul subst %MAYADRIVE% /d
subst %MAYADRIVE% "C:\Program Files\Autodesk\Maya%MAYAVERSION%"
set MAYA_LOCATION=%MAYADRIVE%
set MAYAPYQTBUILD=%~dp0
rem Removing trailing \
set MAYAPYQTBUILD=%MAYAPYQTBUILD:~0,-1%
if exist %BUILDDRIVE%\nul subst %BUILDDRIVE% /d
subst %BUILDDRIVE% "%MAYAPYQTBUILD%"
set SIPDIR=%BUILDDRIVE%\sip-%SIPVERSION%
set PYQTDIR=%BUILDDRIVE%\PyQt5_gpl-%PYQTVERSION%
rem set ADSKQTDIR=%BUILDDRIVE%\qt-%ADSKQTVERSION%
set QTDIR=%MAYA_LOCATION%
set PATH=%QTDIR%\bin;%PATH%
set MSVC_VERSION=2012
set MSVC_DIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0
set QMAKESPEC=%QTDIR%\mkspecs\win32-msvc%MSVC_VERSION%
set _QMAKESPEC_=win32-msvc%MSVC_VERSION%
if ["%LIBPATH%"]==[""] call "%MSVC_DIR%\VC\vcvarsall" amd64
set INCLUDE=%INCLUDE%;%MAYA_LOCATION%\include\python2.7
set LIB=%LIB%;%MAYA_LOCATION%\lib
Build & Install SIP
Please use the script below, you can also find it in GitHub.@echo off
set XXX=%~dp0
if ["%MAYAPYQTBUILD%"]==[""] call "%XXX%setup.bat"
pushd %SIPDIR%
rem "%MAYA_LOCATION%\bin\mayapy" configure-ng.py --spec %_QMAKESPEC_%
"%MAYA_LOCATION%\bin\mayapy" configure.py
nmake
nmake install
popd
Build & Install PyQt
Please use the script below, you can also find it in GitHub.@echo off
set XXX=%~dp0
if ["%MAYAPYQTBUILD%"]==[""] call "%XXX%setup.bat"
set QMAKESPEC=%QTDIR%\mkspecs\%_QMAKESPEC_%
if not exist "%QMAKESPEC%\qmake.conf" (
echo "You need to uncompress %MAYA_LOCATION%\mkspecs\qt-5.6.1-mkspecs.tar.gz !"
goto end
)
if not exist "%MAYA_LOCATION%\include\Qt\QtCore\qdir.h" (
echo "You need to uncompress %MAYA_LOCATION%\include\qt-5.6.1-include.tar.gz in %MAYA_LOCATION%\include\Qt !"
goto end
)
findstr /L /C:"Headers=include/Qt" "%MAYA_LOCATION%\bin\qt.conf" >nul 2>&1
if ERRORLEVEL 1 (
echo "You need to edit %MAYA_LOCATION%\bin\qt.conf to use 'Headers=include/Qt'"
goto end
)
findstr /L /C:"-lqtmain -lshell32" "%QTDIR%\mkspecs\common\msvc-desktop.conf" >nul 2>&1
if ERRORLEVEL 1 (
echo "You need to edit %QTDIR%\mkspecs\common\msvc-desktop.conf to use 'QMAKE_LIBS_QT_ENTRY = -lqtmain -lshell32'"
goto end
)
if not exist "%MAYA_LOCATION%\include\Qt\qtnfc.disabled" (
echo "You need to rename %MAYA_LOCATION%\include\Qt\qtnfc to %MAYA_LOCATION\include\Qt\qtnfc.disabled"
goto end
)
pushd %PYQTDIR%
"%MAYA_LOCATION%\bin\mayapy" configure.py --spec %QMAKESPEC% LIBDIR_QT="%QTDIR%\lib" INCDIR_QT="%QTDIR%\include\Qt" MOC="%QTDIR%\bin\moc.exe" --sip="%QTDIR%\Python\sip.exe" --sip-incdir="%QTDIR%\Python\include" -w --no-designer-plugin
nmake
nmake install
popd
:end
You're done! Please check the testing paragraph at the end of the article.
Testing
Copy and paste this example in the Maya Script Editor (in a Python tab), and execute the code:import sys
from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton)
from PyQt5.QtGui import QFont
class Example(QWidget):
def __init__(self):
super(Example,self).__init__()
self.initUI()
def initUI(self):
QToolTip.setFont(QFont('SansSerif', 10))
self.setToolTip('This is a <b>QWidget</b> widget')
btn = QPushButton('Button', self)
btn.setToolTip('This is a <b>QPushButton</b> widget')
btn.resize(btn.sizeHint())
btn.move(50, 50)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Tooltips')
self.show()
ex = Example()
Comments
You can follow this conversation by subscribing to the comment feed for this post.