Pyqt6 101: A Beginner’s Guide to PyQt6
By Edward Chang
()
About this ebook
Most material on PyQt development is out-of-date. Plus, an initial perusal reveals material that is inaccessible, does not run and is outdated.
This beginner book will:
• Show you the rungs using simple, up-to-date scripts.
• Explain all the basics you need to get started.
• Avoid all the dull theory.
• Slowly guide you to more advanced scripts.
This book is perfect for the beginner who just wants to dabble and will serve as a motivator for further exploration for those interested in longer term use of PyQt6.
Related to Pyqt6 101
Related ebooks
Learning Python Rating: 5 out of 5 stars5/5Python and SQLite Development Rating: 0 out of 5 stars0 ratingsPython: Advanced Guide to Programming Code with Python: Python Computer Programming, #4 Rating: 0 out of 5 stars0 ratingsPython from the Very Beginning Rating: 0 out of 5 stars0 ratingsFresher PyQt5: A Beginner’s Guide to PyQt5 Rating: 0 out of 5 stars0 ratingsPython: Programming For Intermediates: Learn The Basics Of Python In 7 Days! Rating: 0 out of 5 stars0 ratingsModular Programming with Python Rating: 0 out of 5 stars0 ratingsMatplotlib for Python Developers Rating: 3 out of 5 stars3/5Mastering Python Programming: A Comprehensive Guide: The IT Collection Rating: 5 out of 5 stars5/5Essential Python 3 Rating: 0 out of 5 stars0 ratingsVisual Studio Code: End-to-End Editing and Debugging Tools for Web Developers Rating: 0 out of 5 stars0 ratingsPYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Qt 5 Blueprints Rating: 4 out of 5 stars4/5Python for Beginners: A Crash Course to Learn Python Programming in 1 Week Rating: 0 out of 5 stars0 ratingsPython Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5The 1 Page Python Book Rating: 2 out of 5 stars2/5Python Programming: Your Beginner’s Guide To Easily Learn Python in 7 Days Rating: 3 out of 5 stars3/5Python for Beginners: An Introduction to Learn Python Programming with Tutorials and Hands-On Examples Rating: 4 out of 5 stars4/5Building Python Real-Time Applications with Storm Rating: 0 out of 5 stars0 ratingsPython Programming for Beginners: A guide to Python computer language, computer programming, and learning Python fast! Rating: 0 out of 5 stars0 ratingsPython: Tips and Tricks to Programming Code with Python: Python Computer Programming, #3 Rating: 5 out of 5 stars5/5Python Games from Zero to Proficiency (Beginner): Python Games From Zero to Proficiency, #1 Rating: 0 out of 5 stars0 ratingsC++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsPython: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Python: Tips and Tricks to Programming Code with Python Rating: 0 out of 5 stars0 ratingsPython: Advanced Guide to Programming Code with Python Rating: 0 out of 5 stars0 ratingsPython GUI Programming Cookbook - Second Edition Rating: 5 out of 5 stars5/5
Programming For You
Game Development with Unreal Engine 5: Learn the Basics of Game Development in Unreal Engine 5 (English Edition) Rating: 0 out of 5 stars0 ratingsJava for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5C# Programming from Zero to Proficiency (Beginner): C# from Zero to Proficiency, #2 Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Python Machine Learning By Example Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5Problem Solving in C and Python: Programming Exercises and Solutions, Part 1 Rating: 5 out of 5 stars5/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsLearn SQL in 24 Hours Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Raspberry Pi Cookbook for Python Programmers Rating: 0 out of 5 stars0 ratings
Reviews for Pyqt6 101
0 ratings0 reviews
Book preview
Pyqt6 101 - Edward Chang
PyQt6 101
A Beginner’s guide to PyQt6
Edward Chang
Text copyright © 2021 by Edward Chang
All rights reserved. Without limiting the rights under the copyright reserved above, no part of this publication may be reproduced, stored in, or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise) without prior written permission.
For permission requests, please contact: @thehackeruni
ISBN: 9781005490751
Preface
Thanks to the support of my readers, I’m back with my second book on PyQt. This time we focus on PyQt6. I have one concern to address:
Some platforms are yet to embrace PyQt6. Thus, where possible we have provided code and instructions that are also compatible with PyQt5.
I could bore you with a lot of theory about Python, the history of user interface (U.I.) design and so on. But, I trust that you’ll be able to research all the dreary stuff when(if ever!) you need it. Instead, like Neo in the Matrix, we’ll skip all the boring stuff and get right to the meat and potatoes of the subject.
The only assumptions I make are:
That you’re acquainted with the basics of Python. You can always refer to:
https://docs.python.org/3/tutorial/
if you’re a bit rusty.
Some experience using the command line interface (CLI) on your operating system.
Know how to install python modules.
Basic knowledge of the HTTP protocol.
Basic knowledge of MySQL databases. A brief overview can be found at:
https://www.tutorialspoint.com/sql/sql-overview.htm
A beautifully designed e-book with more details can be found at:
https://goalkicker.com/SQLBook/
It also helps to have experience with a visual
programming language like Visual Basic, Delphi or mobile phone programming. But, it’s not necessary.
Conventions used
There are a number of text conventions used throughout this book.
Italics: Used for a new term, an important word, or words, function names, variable names, command-line input and code in text. Here is an example:
Change the button from its default name pushButton to btnBrowse.
When we wish to draw your attention to a particular part of code or output, the relevant lines or items are set in bold: Review the last minute of the video to see this!
Book source code
Source code for the book can be found at:
https://gitlab.com/wohlstetter/pyqt6-101
Images
Some images had to be shrank so they could be displayed in the document. The most important of these can be found in the images folder of the source code.
As always, happy coding!
Chapter 1: Your first PyQt programs
As at the time of writing this (April 14th 2021), the latest version of Python is version 3.9.2. I guess any version of Python 3 will work.
Go to:
https://www.riverbankcomputing.com/software/pyqt/download
download and install the latest version of PyQt appropriate to your operating system. It would be a good idea to make the binaries visible on your system path, i.e. install using adminstrator privileges.
If you want to follow along, you can create a new text file and paste in the following code. Else, this and all other code will be found in the source code that came with your book. The code for each chapter is in a folder named after that chapter.
First example
In the folder for this chapter, open a file named simple.py.
1 from PyQt6.QtWidgets import QApplication, QWidget 1
2
import sys 2
3
4
class MainWindow(QWidget): 3
5
def __init__(self): 4
6 super().__init__()
5
7 self.initUI()
6
8
9
def
initUI(self):
10 self.setWindowTitle(
'Simple example 1') 7
11 self.resize(
230, 254) 8
12 self.show()
9
13
14
15
if __name__ == '__main__': 10
16 qApp = QApplication(sys.argv)
11
17 w = MainWindow()
12
18 sys.exit(qApp.
exec()) 13