ENGLISH

Beginning PyQt: A Hands-On Approach to GUI Programming

Book information

Publisher
Apress
Year
2020
ISBN
1484258568, 9781484258569
Language
english
Format
PDF
Filesize
8 MB (8108740 bytes)
Pages
335\449
Time added
2020-06-03 04:06:48

Description

Learn GUI application development from the ground up, taking a practical approach by building simple projects that teach the fundamentals of using PyQt. Each chapter gradually moves on to teach more advanced and diverse concepts to aid you in designing interesting applications using the latest version of PyQt5. You'll start by reviewing the beginning steps of GUI development from, using different projects in every chapter to teach new widgets or concepts that will help you to build better UIs. As you follow along, you will construct more elaborate GUIs, covering topics that include storing data using the clipboard, graphics and animation, support for SQL databases, and multithreading applications. Using this knowledge, you'll be able to build a photo editor, games, a text editor, a working web browser and an assortment of other GUIs. Beginning PyQt will guide you through the process of creating UIs to help you bring your own ideas to life. Learn what is necessary to begin making your own applications and more with PyQt! What You'll Learn Create your own cross-platform GUIs with PyQt and Python Use PyQt's many widgets and apply them to building real applications Build larger applications and break the steps into smaller parts for deeper understanding Work with complex applications in PyQt, from animation to databases and more Who This Book Is For Individuals who already have a fundamental understanding of the Python programming language and are looking to either expand their skills in Python or have a project where they need to create a UI, but may have no prior experience or no idea how to begin. Table of Contents About the Author About the Technical Reviewer Acknowledgments Introduction Chapter 1: Charting the Course Who Should Read This Book Introduction to User Interfaces What Is a Graphical User Interface? Concepts for Creating Good Interface Design The PyQt Framework Why Choose PyQt? Requirements Links to Source Code How This Book Is Organized Reader Feedback Chapter 2: Getting Started with PyQt Project 2.1 – User Profile GUI Design the GUI Layout Create an Empty Window Explanation Modifying the Window The QLabel Widget Explanation User Profile GUI Solution Explanation Summary Chapter 3: Adding More Functionality to Interfaces Project 3.1 – Login GUI Design the Login GUI The QPushButton Widget Explanation Events, Signals, and Slots The QLineEdit Widget Explanation The QCheckBox Widget Explanation The QMessageBox Dialog Box Windows vs. Dialogs How to Display a QMessageBox Explanation Login GUI Solution Explanation Hiding Input for QLineEdit How to Open a New Window Changing How the Close Event Works Project 3.2 – Create New User GUI Creating a New User GUI Solution Explanation Summary Chapter 4: Learning About Layout Management Choosing a Layout Manager Customizing the Layout Absolute Positioning – Move() Project 4.1 – Basic Notepad GUI The QTextEdit Widget The QFileDialog Class Basic Notepad GUI Solution Explanation The QHBoxLayout and QVBoxLayout Classes Project 4.2 – Survey GUI The QButtonGroup Class Survey GUI Solution Explanation Combining Box Layouts and Arranging Widgets The QFormLayout Class Project 4.3 – Application Form GUI The QSpinBox and QComboBox Widgets Explanation Application Form GUI Solution Explanation The QGridLayout Class Project 4.4 – To-Do List GUI To-Do List GUI Solution Explanation Adding Widgets and Spanning Rows and Columns with QGridLayout Summary Chapter 5: Menus, Toolbars, and More Create a Basic Menu Explanation QMainWindow vs. QWidget Creating the Menubar and Adding Actions Setting Icons with the QIcon Class Explanation Project 5.1 – Rich Text Notepad GUI Design the Rich Text Notepad GUI More Types of Dialog Boxes in PyQt The QInputDialog Class The QFontDialog Class The QColorDialog Class The About Dialog Box Rich Text Notepad GUI Solution Explanation Project 5.2 – Simple Photo Editor GUI Design the Photo Editor GUI QDockWidget, QStatusBar, and More Explanation The QStatusBar Class The QToolBar Class The QDockWidget Class Creating Submenus with Checkable Menu Items Photo Editor GUI Solution Explanation Handling Images in PyQt The QPrinter Class Center GUI Application on Your Desktop Summary Chapter 6: Styling Your GUIs Changing GUI Appearances with Qt Style Sheets Customizing Individual Widget Properties Customizing the QApplication Style Sheet Project 6.1 – Food Ordering GUI Design the Food Ordering GUI The QRadioButton Widget The QGroupBox Class The QTabWidget Class Explanation Food Ordering GUI Solution Explanation Applying the Style Sheet Event Handling in PyQt Explanation Creating Custom Signals Explanation Summary Chapter 7: Creating GUIs with Qt Designer Getting Started with Qt Designer Exploring Qt Designer’s User Interface Qt Designer’s Editing Modes Creating an Application in Qt Designer Project 7.1 – Keypad GUI Keypad GUI Solution Explanation Select a Form Arrange Objects on the Form The QFrame Class Apply Layouts in Qt Designer Edit the Properties of Objects Connect Signals and Slots in Qt Designer Preview Your GUI Create and Edit Python Code Extra Tips for Using Qt Designer Setting Up Main Windows and Menus Adding Menus and Submenus in Qt Designer Adding Toolbars in Qt Designer Adding Actions in Qt Designer Display Images in Qt Designer Summary Chapter 8: Working with the Clipboard The QClipboard Class Explanation Project 8.1 – Sticky Notes GUI Sticky Notes GUI Solution Explanation Drag and Drop in PyQt Explanation The QListWidget Class Explanation Summary Chapter 9: Graphics and Animation in PyQt Introduction to the QPainter Class Explanation The paintEvent() Method The QColor, QPen, and QBrush Classes Drawing Points and Lines Drawing Text Drawing Two-Dimensional Shapes Drawing Gradients Project 9.1 – Painter GUI Painter GUI Solution Explanation Creating the Canvas Class Creating the PainterWindow Class Handling Mouse Movement Events Creating Tool Tips for Widgets Project 9.2 – Animation with QPropertyAnimation Animation Solution Explanation Project 9.3 – RGB Slider Custom Widget PyQt’s Image Handling Classes The QSlider Widget RGB Slider Solution Explanation Updating the Sliders and Spin Boxes Updating the Colors Adding Methods to a Custom Widget RGB Slider Demo Explanation Summary Chapter 10: Introduction to Handling Databases The QTableWidget Class Explanation Creating Context Menus Introduction to Model/View Programming The Components of the Model/View Architecture PyQt’s Model/View Classes Explanation Working with SQL Databases in PyQt What Is SQL? Working with Database Management Systems Getting Familiar with SQL Commands Project 10.1 – Account Management GUI Working with QtSql Explanation Example Queries Using QSqlQuery Explanation Working with QSqlTableModel Explanation Working with QSqlRelationalTableModel Explanation Account Management GUI Solution Explanation Summary Chapter 11: Managing Threads Introduction to Threading Threading in PyQt Methods for Processing Long Events in PyQt Project 11.1 – File Renaming GUI The QProgressBar Widget File Renaming GUI Solution Explanation Summary Chapter 12: Extra Projects Project 12.1 – Directory Viewer GUI Explanation Project 12.2 – Camera GUI Explanation Project 12.3 – Simple Clock GUI Explanation Project 12.4 – Calendar GUI Explanation Project 12.5 – Hangman GUI Explanation Creating the Drawing Class Creating the Main Window Class Project 12.6 – Web Browser GUI Explanation Creating Tabs for the Web Browser Creating the Web View Adding a QProgressBar to the Status Bar Summary Appendix A:Reference Guide for PyQt5 Installing PyQt5 and Qt Designer Getting PyQt for Windows Getting PyQt for MacOS Getting PyQt for Linux (Ubuntu) Other Methods for Getting PyQt Selected PyQt5 Modules Selected PyQt Classes Classes for Building a GUI Window QApplication QWidget Event Handling QMainWindow QDialog QPainter Layout Managers Button Widgets Input Widgets Combo Boxes QLineEdit Text Editing Widgets Spin Box Widgets Slider Widgets Display Widgets QLabel QProgressBar QGraphicsView QLCDNumber Item Views Container Widgets Containers with Frames QScrollArea QMdiArea Qt Style Sheets Summary Appendix B:Python Refresher Installing Python Getting Python for Windows Getting Python for MacOS Getting Python for Linux Data Types in Python Numeric Data Types Arithmetic Operators Working with Numeric Data Types String Data Type Workings with Strings Boolean Data Type Data Structures in Python Lists Tuples Sets Dictionaries Data Type Conversion Conditionals and Loops in Python “if-elif-else” Conditional Statements “for” Loops List Comprehensions “while” Loops Functions Lambda Functions Object-Oriented Programming (OOP) Exception Handling in Python Reading and Writing to Files in Python Summary Index

Similar books