wxPython

wxPython: Converting wx.DateTime to Python datetime

The wxPython GUI toolkit includes its own date / time capabilities. Most of the time, you can just use Python’s datetime and time modules and you’ll be fine. But occasionally you’ll find yourself needing to convert from wxPython’s wx.DateTime objects to Python’s datetime objects. You may encounter this when you use the wx.DatePickerCtrl widget. Fortunately, […]

wxPython: Converting wx.DateTime to Python datetime Read More »

wxPython: Catching Exceptions from Anywhere

The wxPython Google Group was discussing different methods of catching exceptions in wxPython the other day. If you use wxPython a lot, you will soon realize that some exceptions are difficult to catch. The wxPython Wiki explains why. Anyway, the fellows on the list were recommending the use of sys.excepthook. So I took one of

wxPython: Catching Exceptions from Anywhere Read More »

wxPython: How to Catch All Exceptions

One of my friends on the wxPython Google Group asked how to catch any exception that happens in wxPython. The problem is complicated somewhat because wxPython is a wrapper on top of a C++ library (wxWidgets). You can read about the issue on the wxPython wiki. Several wxPython users mentioned using Python’s sys.excepthook to catch

wxPython: How to Catch All Exceptions Read More »

wxPython: An Introduction to Sized Controls

The wxPython toolkit provides an alternative to using Sizers for layout that is known as “sized_controls”. These controls or widgets are basically top-level widgets (like frame, panel, dialog, etc) that have sizing logic built into them. This article will cover all four types of sized_controls. They are as follows: SizedPanel SizedScrolledPanel SizedFrame SizedDialog The SizedScrolledPanel

wxPython: An Introduction to Sized Controls Read More »

wxPython: Wrap Widgets with WrapSizer

wxPython 2.9 introduced the world to a new type of sizer that can take widgets and automatically make them “wrap” around as you resize the frame. That sizer is known as wx.WrapSizer. For some reason, it is relatively unknown, so we’ll spend a few minutes going over how to use it in this article. To

wxPython: Wrap Widgets with WrapSizer Read More »

wxPython 201: Syncing Scrolling Between Two Grids

This week I saw a question on StackOverflow about putting two grids into a SplitterWindow which itself was in a Notebook page. Personally I think that’s a little convoluted, but I thought it was an interesting challenge and I came up with a solution. Then the fellow wanted to know how to sync the scrolling

wxPython 201: Syncing Scrolling Between Two Grids Read More »

wxPython: ObjectListview – How to Double-click items

The other day I was working on a project where I was using the fabulous ObjectListView widget (a wrapper around wx.ListCtrl) and I wanted to add the ability to double-click an item in the control to make it open a PDF. I knew I had read somewhere on the internet about how do this sort

wxPython: ObjectListview – How to Double-click items Read More »

wxPython: Adding Tooltips to ObjectListView

Recently I was trying to figure out how to add tooltips to each item in an ObjectListView widget in wxPython on Windows. The wxPython wiki has an example that uses PyWin32, but I didn’t want to go that route. So I asked on the wxPython Google Group and got an interesting answer. They had actually

wxPython: Adding Tooltips to ObjectListView Read More »

wxPython 101: Using Frame Styles

The wxPython Frame widget is used in almost all wxPython applications. It has the minimize, maximize and close buttons on it as well as the caption along the top that identifies the application. The wx.Frame allows you to modify its styles in such a way that you can remove or disable various buttons and features.

wxPython 101: Using Frame Styles Read More »

wxPython: How to Get Selected Cells in a Grid

Today we will be looking at how to get the selected cells from a wxPython grid object. Most of the time, getting the section is easy, but when the user selects more then one cell, getting the selection becomes more complicated. We will need to create some sample code to show how all this fits

wxPython: How to Get Selected Cells in a Grid Read More »

wxPython: An Introduction to SplitterWindows

The wxPython GUI toolkit comes with lots of widgets. We will be covering some widgets that are somewhat harder to get ones mind wrapped around. In this case, we will be talking about splitter windows. WxPython includes three types of splitter windows: wx.SplitterWindow fourwaysplitter which you can find in wx.lib.agw MultiSplitterWindow which you can find

wxPython: An Introduction to SplitterWindows Read More »