Tag Archives: wxPython

It’s the holiday season so I am putting all my books on sale starting today. The sale will run through December 23rd. You can purchase any of my books for $6.99 on Gumroad or Leanpub. I’m actually recommending Leanpub now as I find its user interface much easier to navigate for my readers, but if you already have a Gumroad account, then feel free to use that.

You will receive the books in PDF, mobi and epub from both Leanpub and Gumroad.

Gumroad

Leanpub

wxPython Cookbook (95% finished…you will receive the early version + the finished product)

Softcover editions

I have 10 more copies of the first run of Python 201: Intermediate Python that you can now purchase. You will also receive the digital versions of the book. Note that the first run had a mistake in the asyncio chapter that has been rectified in the digital copies. The future versions of the paperback will be fixed soon.

I am happy to announce that I now have all the chapters for my latest book, wxPython Cookbook, ready to be checked out. I still consider the book to be in beta mode as I need to go through each chapter and check them over as much as possible this month, but I am also pretty confident that the book is over 90% complete. Some chapters still need a screenshot or two added and I also plan to add another chapter or two as well.

For those of you who like raw data, there are currently 51 recipes in the book + the introduction and installation chapters. There are over 300 pages of content, which is more than either of my previous books!

I hope to do some polishing this week by adding the missing screenshots and also writing a brand new chapter. I am also hoping to get some of the code examples into Github this week. I do apologize for the delay in getting that done. Life has been really crazy on my end.

You can get early access to the book on Leanpub and Gumroad. You will also receive the final product + updates if you purchase the book from either of those websites. You can also check out the original Kickstarter campaign to learn more about the book.

I am excited to announce that the wxPython Cookbook is now available for Pre-Order. You can get your digital copy on Gumroad or Leanpub now. You can get a sample of the book on Leanpub if you’d like to “try before you buy”.

There will be over 50 recipes in this book. The examples in my book will work with both wxPython 3.0.2 Classic as well as wxPython Phoenix, which is the bleeding edge of wxPython that supports Python 3. If I discover any recipes that do not work with Phoenix, they will be clearly marked or there will be an alternative example given that does work.

Here is a partial listing of the current set of recipes in no particular order:

Adding / Removing Widgets Dynamically

How to put a background image on a panel

Binding Multiple Widgets to the Same Handler

Catching Exceptions from Anywhere

wxPython’s Context Managers

Converting wx.DateTime to Python datetime

Creating an About Box

How to Create a Login Dialog

How to Create a “Dark Mode”

Generating a Dialog from a Config File

How to Disable a Wizard’s Next Button

How to Use Drag and Drop

How to Drag and Drop a File From Your App to the OS

How to Edit Your GUI Interactively Using reload()

How to Embed an Image in the Title Bar

Extracting XML from the RichTextCtrl

How to Fade-in a Frame / Dialog

How to Fire Multiple Event Handlers

Making your Frame Maximize or Full Screen

Using wx.Frame Styles

Get the Event Name Instead of an Integer

How to Get Children Widgets from a Sizer

How to Use the Clipboard

Catching Key and Char Events

Learning How Focus Works in wxPython

Making Your Text Flash

Minimizing to System Tray

Using ObjectListView instead of ListCtrl

You can read more about the project in my Kickstarter announcement article. Please note that the Kickstarter campaign is over.

Related Posts

I’ve been toying with the idea of doing a hard cover version of my books for a long time so I thought I might try it out with the Cookbook. I went ahead and ran the numbers using my printer on demand resources and discovered that a regular hard cover isn’t crazy expensive. So I have added a new perk priced at $35 for a hard cover version of the book.

But wait! There’s more! Since the cookbook will have so many screenshots and code examples, it occurred to me that it might be fun to offer a color version of the book. That way you can see the screenshots in full color and you’ll also be able to view the syntax highlighting in the code examples too! Unfortunately, printing in color is crazy expensive. But if you are interested in that option, it is available at $100.

All versions of the book will be signed. If there’s a lot of interest in the black-and-white hard cover, I’ll increase the number of items available for that one.

To get either of these editions or the regular paperback, you will need to pledge on Kickstarter.

I always spend some time thinking about how I want my book’s cover to look. When I was designing the Cookbook’s cover, I thought mostly about food and chefs. I had originally thought I might have some kind of kitchen scene with mice in chef hats and a snake on the mantle. But I wanted to take the idea of cooking and put a twist on it.

Instead of a kitchen, I thought of cowboys herding cattle and how they usually had a cook with them. So I went with that idea, although I didn’t have the herds of animals added to the cover.

To help differentiate the Cookbook from my previous works, I hired a different artist from my previous titles named Liza Tretyakova. You can check out some of her work on Behance or even contact her directly by email (schimmel@inbox.ru) if you happen to need a great artist.

I thought it might be fun for you to see how the cover art evolved as I worked with the artist to get my ideas for the cover turned into reality. Let’s start with the first sketch I got from Liza:

My newest book will be my own home brewed version of a wxPython Cookbook. If you’re interested in learning more about it, then please check out the Kickstarter campaign. The brief synopsis is that it will have a little over 50 recipes in the book and around 300 pages of content.

To help you make an informed decision about whether or not you would like to support the book, I am releasing a few sample chapters. You can download them here as a PDF. Please note that these chapters are in a beta state. I will be updating the vast majority of the book with new screenshots and updated code examples where appropriate as well as various other tweaks and enhancements.

Several years ago, the readers of this blog asked me to take some of my articles and turn them into a cookbook on wxPython. I have finally decided to do just that. I am including over 50 recipes that I am currently editing to make them more consistent and updating them to be compatible with the latest versions of wxPython. I currently have nearly 300 pages of content!

To help fund the initial production of the book, I am doing a fun little Kickstarter campaign for the project. The money raised will be used for the unique perks offered in the campaign as well as various production costs related to the book, such as ISBN acquisition, artwork, software expenses, advertising, etc.

In case you don’t know what wxPython is, the wxPython package is a popular toolkit for creating cross platform desktop user interfaces. It works on Windows, Mac and Linux with little to no modification of your code base.

The examples in my book will work with both wxPython 3.0.2 Classic as well as wxPython Phoenix, which is the bleeding edge of wxPython that supports Python 3. If I discover any recipes that do not work with Phoenix, they will be clearly marked or there will be an alternative example given that does work.

Here is a listing of the current set of recipes in no particular order:

Redirecting stdout to something most developers will need to do at some point or other. It can be useful to redirect stdout to a file or to a file-like object. I have also redirected stdout to a text control in some of my desktop GUI projects. In this article we will look at the following:

The wxPython toolkit added context managers to its code base a few years ago, but for some reason you don’t see very many examples of their use. In this article, we’ll look at three examples of context managers in wxPython. A wxPython user was the first person to suggest using context managers in wxPython on the wxPython mailing list. We’ll start off by rolling our own context manager and then look at a couple of examples of built-in context managers in wxPython.

The other day, I came across an interesting StackOverflow question where the fellow was trying to figure out how to open a sub-frame only once. Basically he wanted a single instance of the sub-frame (and other sub-frames). After digging around a bit on Google, I found an old thread from the wxPython Google Group that had an interesting approach to doing what was needed.

Basically it required a bit of meta-programming, but it was a fun little exercise that I thought my readers would find interesting. Here’s the code: