Develop more dynamic and robust GUI applications using PySide, an open source cross-platform UI frameworkAbout This Book• Designed for beginners to help you get started with GUI application development• Develop your own applications by creating customized widgets and dialogs• Written in a simple and elegant structure so you easily understand how to program various GUI componentsWho This Book Is ForThis book is written for Python programmers who want to learn about GUI programming. It is also suitable for those who are new to Python but are familiar with object-oriented programming.What You Will Learn• Program GUI applications in an easy and efficient way• Download and install PySide, a cross-platform GUI development toolkit for Python• Create menus, toolbars, status bars, and child windows• Develop a text editor application on your own• Connect your GUI to a database and manage it• Execute SQL queries by handling databasesIn DetailElegantly-built GUI applications are always a massive hit among users. PySide is an open source software project that provides Python bindings for the Qt cross-platform UI framework. Combining the power of Qt and Python, PySide provides easy access to the Qt framework for Python developers and also acts as an excellent rapid application development platform.This book will take you through everything you need to know to develop UI applications. You will learn about installing and building PySide in various major operating systems as well as the basics of GUI programming. The book will then move on to discuss event management, signals and slots, and the widgets and dialogs available with PySide. Database interaction and manipulation is also covered.By the end of this book, you will be able to program GUI applications efficiently and master how to develop your own applications and how to run them across platforms.Style and approachThis is an accessible and practical guide to developing GUIs for Python applications.
Author(s): Gopinath Jaganmohan; Venkateshwaran Loganathan
Edition: 2
Publisher: Packt Publishing
Year: 2016
Language: English
Pages: 144
Cover
Copyright
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Getting Started with PySide
Introducing PySide
Hello, GUI
Setting up PySide
Installing PySide using Windows
Installing PySide using Mac OS X
Installing PySide using Linux
Building PySide on Windows
Building PySide on Linux
Prerequisites
Building PySide
Mac OS X
Importing PySide objects
First PySide application
Exception handling as a practice
Summary
Chapter 2: Entering through Windows
Creating a simple window
Creating the application icon
Showing a tooltip
Adding a button
Centering the window on the screen
About box
Tracking time using timers
Windows style
Summary
Chapter 3: Main Windows and Layout Management
Creating the main window
Status bar
Menu bar
The central widget
Adding a menu bar
Adding menus
Toolbar
Layout management
Absolute positioning
Layout containers
QBoxLayout
QHBoxLayout
QVBoxLayout
QGridLayout
QFormLayout
QStackedLayout
SDI and MDI
A simple text editor
Summary
Chapter 4: Events and Signals
Event management
Event loop
Event processing
Reimplementing event handlers
Installing event filters
Reimplementing the notify() function
Signals and slots
Drag and drop technique
Drawing shapes
Graphics and effects
Summary
Chapter 5: Dialogs and Widgets
Built-in dialogs
QFileDialog
QInputDialog
QColorDialog
QPrintDialog
Custom dialogs
Widgets at a glance
Custom widget
Implementation of MDI
Summary
Chapter 6: Database Handling
Connecting to the database
Executing SQL queries
Executing a query
Inserting, updating and deleting records
Navigating records
Database transactions
Table and form views
QSqlQueryModel
QSqlTableModel
QSqlRelationalTableModel
Table view
Form view
Viewing relations in table views
Summary
Index