The wxPython Cookbook is for anyone wanting to learn neat tips and tricks with the wonderful wxPython toolkit. With wxPython, you can create cross-platform desktop user interfaces quite easily. There are over 50 recipes included in this book. This book is targeted for Python 2 and 3.
Note: This book is currently no longer available as it was relicensed to Apress Publishing as wxPython Recipes
Cover art by Liza Tretyakova. You can see more of Liza’s work on Behance.
Table of Contents
- Who Should Read This Book
- About the Author
- Conventions
- Requirements
- Book Source Code
- Reader Feedback
- Errata
- Classic
- wxPython Phoenix
- The wxPython Docs and Demo Package
- Wrapping Up
- Wrapping Up
- Getting Started
- The Snapshot Printer Script
- Wrapping Up
- Extracting an Image from the Executable
- Using Your Own Image
- Create the Image in Python Code
- Wrapping Up
- A Bad Example
- A Better Example
- Wrapping Up
- Wrapping Up
- Into the Darkness
- Trying Out Dark Mode
- Wrapping Up
- The Current pubsub API
- Wrapping Up
- Getting Started
- Wrapping Up
- How do you Disable the Wizard’s Next Button Anyway?
- Getting it to Work with Phoenix
- Wrapping Up
- Catching Exceptions
- Creating an Exception Catching Decorator
- Wrapping Up
- Creating Your Own wxPython Context Manager
- wxPython’s Context Managers
- Wrapping Up
- Wrapping Up
- Using wx.AboutBox
- Using HtmlWindow for an About Box
- Updating the Code for wxPython Phoenix
- Wrapping Up
- Using Pubsub
- Using an Instance Variable
- Wrapping Up
- The Config File
- Creating the GUI
- Wrapping Up
- Getting Started
- Creating a Controller
- Creating the View
- Wrapping Up
- Getting Started
- Wrapping up
- Wrapping Up
- Wrapping Up
- Catching Key Events
- Catching Char Events
- Wrapping Up
- Getting Started
- Creating a FileDropTarget
- Creating a TextDropTarget
- Custom DnD with PyDropTarget
- Creating A Custom Drag-and-Drop App
- Wrapping Up
- Getting Started
- Wrapping Up
- Creating the Reloading App
- Creating the Dynamic Application
- Wrapping Up
- Extracting XML
- Updating for Phoenix
- Wrapping Up
- Wrapping Up
- Creating Flashing Text
- Creating Changing Text
- Wrapping Up
- Maximizing the Frame
- Making Your Application Full Screen
- Wrapping Up
- Getting Started
- Create a Frame Without a Caption
- Create a Frame With a Disabled Close Button
- Create a Frame Without Maximize/Minimize
- Create a Un-Resizable Frame
- Create a Frame Without a System Menu
- Create a Frame That Stays on Top
- Wrapping Up
- Creating the TaskBarIcon in Classic
- Creating the TaskBarIcon in Phoenix
- Wrapping Up
- Creating a Simple TaskBarIcon
- Making the Application Minimize to Tray
- Wrapping Up
- Wrapping Up
- Wrapping Up
- Acquiring Focus
- Losing Focus
- Wrapping Up
- Creating a Simple Shortener
- Shortening URLs with Other Shorteners
- Wrapping Up
- Wrapping Up
- Wrapping Up
- Wrapping Up
- Getting Started (with a Bar Graph!)
- Graphing Using Saved Data
- Point Plot with Thousands of Points
- Creating a Sine / Cosine Graph
- Wrapping Up
- Wrapping Up
- The thread-safe method
- The Non Thread-safe method
- Wrapping Up
- The Simple Notebook
- The Refactored Notebook
- Wrapping Up
- Wrapping Up
- Adding Objects to wx.ListBox
- Adding Objects to the wx.ComboBox
- Wrapping Up
- Wrapping Up
- A Simple Timer
- Using Multiple Timers
- Wrapping Up
- Updating the Code for wxPython 3.0.2.0 + Phoenix
- Wrapping Up
- wxPython’s Thread-safe Methods
- wxPython, Threading, wx.CallAfter and PubSub
- Making Threads and Pubsub work in Phoenix
- wx.PostEvent and Threads
- Wrapping Up
- Getting Started
- Adding Update Code to the Initial Release
- Preparing the New Release
- Updating Your Program
- Wrapping Up
- Creating a Login Screen with XRC
- Creating a Notebook with XRC
- Adding Controls Outside of XRC
- Wrapping Up
- Wrapping Up
- Getting Started
- Creating Our First Application
- Creating Something More Complex
- Using XRCed to Generate Python Code
- Wrapping Up
- Using Faux Spacers
- Using AddStretchSpacer
- Centering Without Nesting Sizers
- Wrapping Up
- Using WrapSizer
- Wrapping Up
- Grid Cell Selection
- Wrapping Up