Category Archives: wxPython

wxPython Font by Pixel Height

I’ve been looking to find a way to resize a font when the window’s size changes. Here is code that will create a font that is close as possible to a given height in pixels without specifying anything about the … Continue reading

Posted in Python, wxPython | Leave a comment

Update to TimeSpin Control for wxGlade

TimeSpin has a bug in that it reports the same width for GetBestSize when AM/PM is shown and when it is not (24 hour format). This causes an empty space to appear after the control when it is set to … Continue reading

Posted in Python, wxPython | Leave a comment

Update to TimeCtrl/TimeSpin wxGlade extension

I added a workaround for a problem with timectrl. You’ll want to upgrade to the 1.4 version of the time_spin_and_control distribution if you use limited, min, max, or value parameters in Glade when specifying the control. Edit – 3/8 – … Continue reading

Posted in Python, wxPython | 2 Comments

Adding a TimeCtrl Widget to wxGlade

The program I’m working on (ErgMate) requires entry of hours/mins/seconds durations. I just defined input as total number of seconds for the initial prototypes, but the time has come to make it more usable. I was able to create the … Continue reading

Posted in Python, wxPython | Leave a comment

Exception when Generating Code from wxGlade – and how to fix it

This morning I started getting the following exception when generating code from wxGlade: <pre> Traceback (most recent call last):   File "c:\temp\wxGlade\application.py", line 394, in generate_code     class_names=class_names)   File "c:\temp\wxGlade\xml_parse.py", line 503, in __init__    .    .    .   File "c:\temp\wxGlade\xml_parse.py", … Continue reading

Posted in wxPython | Leave a comment

Watch out for wxGlade’s Overwrite Sources!

wxGlade has an option for ‘overwrite sources’ in the application dialog: I normally have it off, but when doing some exploratory testing I enabled it. This morning I was working on my main application and regenerated the code. Guess what? … Continue reading

Posted in wxPython | Leave a comment

Py2Exe Changing wxPython Look and Feel

I just noticed that my wxPython application looks different after creation of an exe with Py2Exe. The image on the left is the application running under the normal python interpreter. The one on the right is the same application after … Continue reading

Posted in wxPython | 3 Comments

Adding Custom Widgets to wxGlade

wxGlade has the ability to integrate custom or 3rd party widgets into its pallette. This feature is not documented very well. By using some sample code from Alberto Griggio and digging through the core-widgets source code, I was able to … Continue reading

Posted in Python, wxPython | 5 Comments

Cleaning up panel resources when a parent frame is closed

I try to create reusable windows as subclases of wx.Panel and then insert them into frames as needed. This morning I had a panel that needed to perform some cleanup. The problem was that the close event happens on the … Continue reading

Posted in Python, wxPython | Leave a comment

Adding / Removing Controls from a wxPython Frame

I have a mini-Frame whose child controls change based on a user selection. It took awhile to get the resizing and layout working as controls are added and removed from the panel. This is the final code that works. The … Continue reading

Posted in Python, wxPython | Leave a comment