wxPython


Earlier this week, there was a discussion on the wxPython IRC channel about how to store objects in wx.ListBox. Then later on that day, there was a question on StackOverflow about the same thing, but in relation to the wx.ComboBox. Fortunately, both of these widgets inherit from wx.ItemContainer and contain the Append method, which allows you to associate an object with an item in these widgets. In this article, you will find out how this is done. (more…)

Back in 2006, Manning released the excellent wxPython in Action book by Noel Rappin and Robin Dunn (creator of wxPython). This is still a great book and I wholeheartedly recommend it to people that want to increase their understanding of wxPython. However, Packt Publishing has just released the first new wxPython book in over four years. It’s called wxPython 2.8 Application Development Cookbook by Cody Precord (creator of Editra). There’s an ebook version of each of these books at their respective publisher’s websites.

I plan to review Precord’s book once I’ve finished reading it. He’s been pretty active on the wxPython mailing list, helping people (including me) learn the ins and outs of wxPython. If you like wx as much as I do, I hope you’ll support him and the wxPython community by buying the book. Packt gives part of the purchase price of the book back to the project that it’s about, which is pretty cool. They’re also having a Python book sale on the Packt website (hat tip to Robin Dunn on that one).

When I originally started this blog, it was mostly a brain dump on my part so I wouldn’t forget how I did something cool with Python. Later on, I decided to use it to also document what I considered under-documented portions of wxPython. If my posts drew enough interest, I would also re-work the post into a wiki page on the wxPython wiki. (more…)

Almost any computer power user will want to use keyboard shortcuts (AKA: accelerators) to get their work done. Fortunately for us, wxPython provides a way to accomplish this very easily using an Accelerator Table via the wx.AcceleratorTable class. In this article we will look at a couple examples to see how this is accomplished. (more…)

If you’re new to wxPython but not new to XML, you might find this article useful to you. Why? Because wxPython supports XRC, an XML file format that describes the GUI in XML, duh. In fact, wxPython’s Documentation & Demos package includes an editor just for creating and manipulating these files that is called, XRCed. This article will take you on a journey to see XRCed’s features and general usage. (more…)

The wxPython project is one of the most popular and easy to use Python GUI toolkit. It wraps the popular C++ wxWidgets project using SWIG. It is also the only cross-platform toolkit that I am aware of that uses the native widgets on each platform wherever possible (for better or for worse). Some like to say that PyQt does this as well, but from what I’ve read, PyQt actually draws all its controls to mimic the native controls, it doesn’t actually use them. Anyway, that’s neither here nor there. The topic is the wxPython Demo. There are lots of people who do not know that this demo even exists.

The wxPython Demo is an extra download from wxPython’s main website. It has a runnable example of nearly every widget included with wxPython. In this article, we’ll take a quick look at what this demo can do. (more…)

Some people learn through doing it, others are better with visual stimuli. At least, that’s what we’re told. So in the spirit of what we’ve been taught, we’re going to take a look at the visual half of the equation and see how we can make graphs with wxPython. You may not know this, but wxPython includes a widget just for this purpose. It’s name is PyPlot. PyPlot is great at doing simple plots and it’s super fast too! If you need to weird or complicated plotting, then you’ll want to use matplotlib instead. Fortunately, wxPython and matplotlib play well with each other, but we won’t be looking at matplotlib in this article. (more…)

The other day, I received a complaint that my original notebook example in my Book control series was too complicated. I don’t really write just n00b-friendly articles and never claimed to, but this comment rankled, so I decided to write a super simple example for the wxPython newbies. I hope you like it! (more…)

A few months ago, I wrote about creating a simple MP3 Player using wxPython’s MediaCtrl widget. Since then, a fellow released the MplayerCtrl, a wxPython widget that wraps mplayer, a popular cross-platform media player. I actually ended up switching my MP3 Player’s backend to use this new control, but that’s a story for another post. This article will just focus on creating a really simple Media Player that you can play movies with. And you can do it all with Python! If you’re like me, you’ll think this rocks! (more…)

For the second half of this series, I discovered that there are even more dialogs than I originally thought. While it would have probably been a good idea to have split this into three parts, we’re going to stick with just two. In this article, we’re going to cover the following dialogs:

  • GenericMessageDialog (AGW)
  • ImageDialog
  • wx.MultiChoiceDialog
  • wx.PageSetupDialog
  • wx.PrintDialog
  • wx.ProgressDialog
  • PyBusyInfo (AGW)
  • PyProgress (AGW)
  • ScrolledMessageDialog
  • wx.SingleChoiceDialog
  • wx.TextEntryDialog

For the uninitiated, there’s also an AboutBox dialog that’s not here for the very simple reason that it’s already been covered in this blog outside of this series. Check that out for yourself. Just to clear up any confusion about why wx.Dialog isn’t here: this series ONLY covers pre-built dialogs. The wx.Dialog widget is great for creating your own custom dialogs. The last note that should be covered is that the example code here has been yanked from the wxPython demo and re-purposed for this article. (more…)

« Previous PageNext Page »