Python

wxPython: How to Update a Progress Bar from a Thread

Every now and then, I see someone wondering how to create a progress bar and update it. So I decided to whip up an example application that updates a progress bar (technically a wx.Gauge widget) from a thread. In this tutorial, we will create a frame with a button. When the button is pushed, it […]

wxPython: How to Update a Progress Bar from a Thread Read More »

Book Preview: Building Machine Learning Systems with Python

Earlier this year, Packt Publishing asked me to be a technical reviewer of one of their upcoming books, “Building Machine Learning Systems with Python” by Willi Richert and Luis Pedro Coelho. Now the book is available for purchase and they have asked me to write a little about it. I haven’t read through the finished

Book Preview: Building Machine Learning Systems with Python Read More »

wxPython: How to Redirect Python’s Logging Module to a TextCtrl

Today I was reading the wxPython Google group / mailing list and there was someone asking about how to make Python’s logging module write its output to file and to a TextCtrl. It turns out that you need to create a custom logging handler to do it. At first, I tried just using a normal

wxPython: How to Redirect Python’s Logging Module to a TextCtrl Read More »

wxPython: How to Edit Your GUI Interactively Using reload()

Today, I came across an interesting question on StackOverflow where the author was asking how he could write a wxPython program dynamically. In other words, he wanted to be able to edit the code and basically refresh the application without closing and re-running his code. The simplest way would be to use Python’s built-in reload

wxPython: How to Edit Your GUI Interactively Using reload() Read More »

wxPython: Creating a Grid with XRC

I recently tried to help someone (on the wxPython mailing list) figure out how to use a Grid widget (wx.grid.Grid) via XRC. It should be simple, but if you run the code below, you’ll discover a weird issue: import wx from wx import xrc ######################################################################## class MyApp(wx.App): def OnInit(self): self.res = xrc.XmlResource(“grid.xrc”) frame = self.res.LoadFrame(None,

wxPython: Creating a Grid with XRC Read More »

Bottle – Adding SQLAlchemy to the Todo List Web App

In this article we will be taking the code from the previous article on Bottle and changing it such that it uses SQLAlchemy instead of just normal SQLite code. This will require you to download the bottle-sqlalchemy package from PyPI. You can also install it using “pip install bottle-sqlalchemy”, assuming you have pip installed. You

Bottle – Adding SQLAlchemy to the Todo List Web App Read More »

Bottle – Creating a Python Todo List Web App

Python has lots of web frameworks. Bottle is one of them and is considered a WSGI Framework. It’s also sometimes called a “micro-framework”, probably because Bottle consists of just one Python file and has no dependencies besides Python itself. I’ve been trying to learn it and I was using the official Todo-list tutorial on their

Bottle – Creating a Python Todo List Web App Read More »

Using Python to Teach About Finding the Digital Root

My wife teaches 3rd grade math and she recently learned about the process of obtaining the digital root of numbers. The digital root is a single digit number found by summing the individual digits. So for 15, you would add 1+5 to get 6. Thus 6 is the digital root of 15. The trainer that

Using Python to Teach About Finding the Digital Root Read More »