O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

PySide GUI Application Development - Second Edition

Book Description

Develop more dynamic and robust GUI applications using PySide, an open source cross-platform UI framework

About 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 components

Who This Book Is For

This 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 databases

In Detail

Elegantly-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 approach

This is an accessible and practical guide to developing GUIs for Python applications.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. PySide GUI Application Development Second Edition
    1. Table of Contents
    2. PySide GUI Application Development Second Edition
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Getting Started with PySide
      1. Introducing PySide
      2. Hello, GUI
      3. Setting up PySide
      4. Installing PySide using Windows
      5. Installing PySide using Mac OS X
      6. Installing PySide using Linux
      7. Building PySide on Windows
      8. Building PySide on Linux
        1. Prerequisites
      9. Building PySide
        1. Mac OS X
      10. Importing PySide objects
      11. First PySide application
      12. Exception handling as a practice
      13. Summary
    9. 2. Entering through Windows
      1. Creating a simple window
      2. Creating the application icon
      3. Showing a tooltip
      4. Adding a button
      5. Centering the window on the screen
      6. About box
      7. Tracking time using timers
      8. Windows style
      9. Summary
    10. 3. Main Windows and Layout Management
      1. Creating the main window
      2. Status bar
        1. Menu bar
          1. The central widget
        2. Adding a menu bar
        3. Adding menus
      3. Toolbar
      4. Layout management
        1. Absolute positioning
        2. Layout containers
        3. QBoxLayout
          1. QHBoxLayout
          2. QVBoxLayout
        4. QGridLayout
        5. QFormLayout
        6. QStackedLayout
      5. SDI and MDI
      6. A simple text editor
      7. Summary
    11. 4. Events and Signals
      1. Event management
        1. Event loop
        2. Event processing
          1. Reimplementing event handlers
          2. Installing event filters
          3. Reimplementing the notify() function
      2. Signals and slots
      3. Drag and drop technique
      4. Drawing shapes
      5. Graphics and effects
      6. Summary
    12. 5. Dialogs and Widgets
      1. Built-in dialogs
        1. QFileDialog
        2. QInputDialog
        3. QColorDialog
        4. QPrintDialog
      2. Custom dialogs
      3. Widgets at a glance
      4. Custom widget
      5. Implementation of MDI
      6. Summary
    13. 6. Database Handling
      1. Connecting to the database
      2. Executing SQL queries
        1. Executing a query
        2. Inserting, updating and deleting records
        3. Navigating records
        4. Database transactions
      3. Table and form views
        1. QSqlQueryModel
        2. QSqlTableModel
        3. QSqlRelationalTableModel
      4. Table view
      5. Form view
      6. Viewing relations in table views
      7. Summary
    14. Index