pyqt: rapid application development
DESCRIPTION
PyQt: rapid application developmentTRANSCRIPT
![Page 2: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/2.jpg)
Qt and C++
Qt is a wonderful piece of software Application multi-platform portability layer Lots of modules and features But... it exposes a C++ API
![Page 3: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/3.jpg)
What's wrong with C++?
Compile/run workflow Manual memory management (Few) testing facilities Wrong frame of mind Steep learning curve
![Page 4: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/4.jpg)
Learning C++ in 21 days
![Page 5: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/5.jpg)
2 words about Python
Object-oriented language Automatic memory management Language uses strong/dynamic typing
Objects have types, references don't
Code is compiled on-the-fly No compile/run workflow
Easy to pick up
![Page 6: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/6.jpg)
Learning Python in 21 14 days
![Page 7: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/7.jpg)
What is PyQt
A binding that maps every Qt class to a Python class
It's not Qt rewritten in Python → Easy to keep in sync with Qt
Developed by Riverbank Software (UK based)
Qt's feature set + Python development speed = profit!
![Page 8: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/8.jpg)
First PyQt program
from PyQt4.Qt import *
app = QApplication([])l = QLabel(“Hello world!”)l.show()app.exec_()
![Page 9: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/9.jpg)
Signal/slot
Any Python callable can be a slot!
from PyQt4.Qt import *
app = QApplication([])
pb = QPushButton("Click me!")pb.show()
def cb(): pb.setText("CLICKED!")
QObject.connect(pb, SIGNAL("clicked(bool)"), cb)
app.exec_()
![Page 10: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/10.jpg)
A simple text editor
Live demo
![Page 11: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/11.jpg)
Reality check
CAD/CAM for fashion design Uses PyQt from day 1 200000 LOC codebase (including tests) In production since 2008, actively mantained
Medical appliance control panel Full rewrite of a 1 man-year C++ application
become unmaintenable Development completed in 3 man months
...many others
![Page 12: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/12.jpg)
PyQt licensing
Qt: GPL / LGPL / commercial PyQt: GPL (no LGPL!) → PyQt GPL:
ok for internal tools ok for open-source software
Otherwise: PyQt commercial license
![Page 13: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/13.jpg)
Urban myths
“Python is too slow to develop real applications!”
FALSE: In a typical PyQt application, the bulk of the running code is “inside” Qt, hence running at C++ speed.
“I must distribute the Python interpreter along with my program source!”
FALSE: you can package your application (PyInstaller), then bundle into a nice graphical installer (InnoSetup)
![Page 14: PyQt: rapid application development](https://reader034.vdocument.in/reader034/viewer/2022042507/556166dcd8b42a5f4b8b510d/html5/thumbnails/14.jpg)
THANKS !THANKS !
Contacts
Mail: [email protected]
Phone: +39-055-3984627
Fax: +39 178 6003614
http://www.develer.com
Develer S.r.l.Via Mugellese 1/A
50013 Campi BisenzioFirenze - Italy