You are previewing wxPython Application Development Cookbook.
O'Reilly logo
wxPython Application Development Cookbook

Book Description

Over 80 step-by-step recipes to get you up to speed with building your own wxPython applications

About This Book

  • This book empowers you to create rich cross-platform graphical user interfaces using Python

  • It helps you develop applications that can be deployed on Windows, OSX, and Linux

  • The recipes in the book involve real-world applications, giving you a first-hand experience of the practical scenarios

  • Who This Book Is For

    For those who are familiar with programming in Python and want to start building applications with graphical user interfaces, this book will get you up and running quickly. A basic understanding of the Python programming language and object-oriented concepts are all that is needed.

    What You Will Learn

  • Create full featured user interfaces

  • Design and develop custom controls

  • Deploy and distribute wxPython applications to Windows, Macintosh OS X, Linux, and other UNIX-like environments

  • Handle and respond to application events

  • Manage and display data using grids

  • Interact with web services from your GUI

  • Use Paint events to draw custom displays

  • Support the display of user interfaces in multiple languages

  • In Detail

    wxPython is a GUI toolkit for the Python programming language built on top of the cross-platform wxWidgets GUI libraries. wxPython provides a powerful set of tools that allow you to quickly and efficiently building applications that can run on a variety of different platforms. Since wxWidgets provides a wrapper around each platform’s native GUI toolkit, the applications built with wxPython will have a native look and feel wherever they are deployed.

    This book will provide you with the skills to build highly functional and native looking user interfaces for Python applications on multiple operating system environments. By working through the recipes, you will gain insights into and exposure to creating applications using wxPython. With a wide range of topics covered in the book, there are recipes to get the most basic of beginners started in GUI programming as well as tips to help experienced users get more out of their applications. The recipes will take you from the most basic application constructs all the way through to the deployment of complete applications.

    Style and approach

    This book is a collection of step-by-step recipes that introduce the various components and concepts of wxPython in a conversational and easy-to-follow way. Each recipe contains coded examples along with detailed explanations about the key points of each topic. Each topic is designed to introduce and show you how to use a single feature from the wxPython library.

    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. wxPython Application Development Cookbook
      1. Table of Contents
      2. wxPython Application Development Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      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. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. wxPython Starting Points
        1. Introduction
        2. Creating an application object
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        3. Adding the main frame
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Using bitmaps
          1. How to do it…
          2. How it works…
          3. There's more…
        5. Binding to events
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Understanding the hierarchy of the UI
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Controlling the propagation of events
          1. How to do it…
          2. How it works…
          3. There's more…
        8. Accessing the clipboard
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        9. Supporting drag and drop
          1. How to do it…
          2. How it works…
          3. There's more…
        10. Handling AppleEvents
          1. How to do it…
          2. How it works…
          3. There's more…
      9. 2. Common User Controls
        1. Introduction
        2. Starting with the easy button
          1. How to do it…
          2. How it works…
          3. See also
        3. Pushing all the buttons
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Offering options with CheckBoxes
          1. How to do it…
          2. How it works…
        5. Using TextCtrl
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Processing key events
          1. How to do it…
          2. How it works…
          3. There's more…
        7. Picking dates with DatePickerCtrl
          1. How to do it…
          2. How it works…
          3. There's more…
        8. Exploring menus and shortcuts
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        9. Displaying a context menu
          1. How to do it…
          2. How it works…
          3. See also
        10. Working with ToolBars
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        11. Managing UI states
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
      10. 3. UI Layout and Organization
        1. Introduction
        2. Laying out controls with Sizers
          1. How to do it…
          2. How it works…
          3. See also
        3. Controlling layout behavior
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Grouping controls with a StaticBox control
          1. How to do it…
          2. How it works…
          3. There's more…
        5. Creating an automatic wrapping layout
          1. How to do it…
          2. How it works…
        6. Using the standard dialog button sizer
          1. How to do it…
          2. How it works…
          3. There's more…
        7. Simplifying the panel layout
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        8. Making dialog layout easy
          1. Getting ready
          2. How to do it…
          3. How it works…
        9. Building XML resource-based layouts
          1. How to do it…
          2. How it works…
          3. There's more…
        10. Extending XRC for custom controls
          1. How to do it…
          2. How it works…
          3. There's more…
        11. Advancing your UI with AuiManager
          1. How to do it…
          2. How it works…
          3. There's more…
            1. Additional AuiPaneInfo options
            2. Saving and restoring a window's state
      11. 4. Containers and Advanced Controls
        1. Introduction
        2. Adding tabs with the Notebook control
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        3. Enhancing ComboBox with bitmaps
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Configuring properties
          1. How to do it…
          2. How it works…
          3. There's more…
        5. Taking control with FlatNotebook
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Styling text in StyledTextCtrl
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Annotating StyledTextCtrl
          1. Getting started
          2. How to do it…
          3. How it works…
          4. There's more…
        8. Displaying hierarchical data with TreeCtrl
          1. How to do it…
          2. How it works…
          3. There's more…
        9. Building a system tray application
          1. Getting started
          2. How to do it…
          3. How it works…
          4. There's more…
        10. Surfing the Web in your app
          1. How to do it…
          2. How it works…
          3. There's more…
      12. 5. Data Displays and Grids
        1. Introduction
        2. Displaying lists of data
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        3. Editing data lists
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Implementing a data source
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        5. Getting started with the data grid
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
            1. Custom Editors
            2. Managing Attributes
          5. See also
        6. Displaying dynamic data
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Modeling your data
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        8. Displaying your data model
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
      13. 6. Ways to Notify and Alert
        1. Introduction
        2. Showing MessageBox
          1. How to do it…
          2. How it works…
          3. There's more…
            1. Button flags
            2. Icon flags
        3. Using InfoBar
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Providing extra tips on usage
          1. How to do it…
          2. How it works…
        5. Displaying transient notifications
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Making a splash at startup
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Giving busy feedback
          1. How to do it…
          2. How it works…
        8. Showing information about your app
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
      14. 7. Requesting and Retrieving Information
        1. Introduction
        2. Selecting files with FileDialog
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        3. Searching text with FindReplaceDialog
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
        4. Filtering through choices
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        5. Retrieving multiple selections
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        6. Using Print dialogs
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        7. Guiding selections with Wizard
          1. How to do it…
          2. How it works…
          3. There's more…
      15. 8. User Interface Primitives
        1. Introduction
        2. Painting in your UI
          1. How to do it…
          2. How it works…
          3. See also
        3. Drawing basic shapes
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Customizing grid labels
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Drawing gradients with GraphicsContext
          1. How to do it…
          2. How it works…
          3. There's more…
        6. Recreating native controls with RendererNative
          1. How to do it…
          2. How it works…
          3. There's more…
      16. 9. Creating and Customizing Components
        1. Introduction
        2. Making your own dialog
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        3. Validating user input
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Interacting with StatusBar
          1. How to do it…
          2. How it works…
          3. There's more…
        5. Providing your own information window
          1. How to do it…
          2. How it works…
          3. See also
        6. Creating a managed layout
          1. How to do it…
          2. How it works…
        7. Drawing your own list control
          1. How to do it…
          2. How it works…
          3. There's more…
        8. Implementing highlighting in StyledTextCtrl
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        9. Creating a composite control
          1. How to do it…
          2. How it works…
          3. See also
        10. Designing an owner-drawn control
          1. Getting ready
          2. How to do it…
          3. How it works
          4. See also
      17. 10. Getting Your Application Ready for Release
        1. Introduction
        2. Storing your configuration with StandardPaths
          1. How to do it…
          2. How it works...
          3. There's more...
        3. Saving the application's state
          1. How to do it…
          2. How it works...
          3. See also
        4. Supporting internationalization
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        5. Optimizing for OS X
          1. How to do it…
          2. How it works…
          3. There's more…
            1. ToolBars
          4. See also
        6. Handling errors gracefully
          1. How to do it…
          2. How it works…
        7. Embedding your resources
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        8. Distributing an application
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        9. Updating your software
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
      18. Index