Python Programming, news on the Voidspace Python Projects and all things techie.
Images & Wax
The answer (of course!) was to remove the old image object before adding the new one. Lest this be of interest to anyone else, the following code will display images from a subdirectory (called images). To display a new image, press the "update" button.
from wax import *
the_dir = 'images'
p = FlexGridPanel(self, rows=6, cols=3, hgap=5, vgap=2)
b = Button(p, 'update')
b.OnClick = self.update
p[0, 0] = Label(p, " ", border=5)
p[1, 0] = Label(p, "An Image:", border=5)
p[2, 0] = Label(p, " ", border=5)
p[1, 1] = b
self.vp = vp = VerticalPanel(p)
p[1, 5] = vp
self.p = p
self.files = [os.path.join(the_dir, e) for e in os.listdir(the_dir)]
self.count = 1
def update(self, event=None):
index = self.count % len(self.files)
image = self.files[index]
self.bitmap = Image(image).ConvertToBitmap()
bmp = Bitmap(self.vp, self.bitmap)
items = self.vp.GetSizerItems()
self.vp.ReplaceComponent(items, bmp, destroy=1)
self.count += 1
app = Application(MainFrame, direction='v')
This requires Wax 0.3.32 (or more recent) which added GetSizerItems.
|||It has several themes to choose from when creating a new blog, and shows a preview of all the different themes.|
Look in my Toolbox
The last time I had to re-install windows remembering all the programs I needed was a nightmare.
I've put together a list of all the programs and utilities that I use regularly. This list serves two purposes. First I hope it is either useful, interesting or provocative. Second, it is a place for me to keep a list of all the programs I use.
Most of these tools are shareware or freeware, but there are one or two commercial programs I use regularly. I obviously choose free and open source code wherever possible.
Rene Tse has written a new article on VoIP.
VoIP really is about mobility. This article is about using Wi-Fi enabled devices capable of Voice Over IP. It provides a mini tutorial on how to install four VoIP applications on Linux, Apple Mac or Windows operating systems.
Oh and by the way, my insomnia has caused a 'possibly interesting' blog entry about two factoids from my childhood, over in my Personal Blog.
It doesn't deserve an entry here, but it's kind-of-almost-techie, so I thought I would mention it.
I use Haloscan to enable (and manage) comments on this blog.
The major advantage of Haloscan is that it is very easy to integrate with Firedrop2 (or any other blog system for that matter). I also get very few spam comments.
Up until recently I thought that the major downside was that comments only lasted a few months. Stewart Midwinter recently pointed out to me that for only $12 you can upgrade your account which has all sorts of benefits. (Including email notification of comments and the ability to customize the comments pages). Upgrading even brings previously deceased comments back from the dead.
I'm still vaguely looking for a solution I can run on my server (that doesn't use PHP and is easy to run behind lighttpd).
This is because Haloscan still has the following limitations :
- Comments pages aren't integrated into the rest of my site
- Threaded comments would be nicer
- I'd still rather have control of the data myself
|||Perhaps this is why spam is low ?|
If you're using Firedrop, give me a heads-up and I'll add your feed.
I've just added Digg it and Del.icio.us it links to all of my entries. You can do the same by adding the following snippets to your entry_template.html :
<small>Like this post? <a href="http://digg.com/submit?phase=2&url=http://www.yourblog.com/ <% permalink(entry.get_id()) %>">Digg it</a> or < a href="http://del.icio.us/post?url=http://www.yourblog.com/ <% permalink(entry.get_id()) %>">Del.icio.us it</a>.</small>
The lines here are split to fit on the page: rejoin them to make it work.
I'm still hoping to a new release out real soon, hopefully tomorrow. The new release will include a Themes Plugin created by Stewart Midwinter. This has several pre-created (and damn fine looking) styles for new blogs. There are also separate RSS feeds generated for each category, contributed by Davy Mitchell.
You can see the page (html) it generates at :
The code that does this is already in subversion.
Shortly after this will be another release, hopefully including a podcast plugin created by Ron Stephens and myself, blog statistics by Davy Mitchell , and possibly a tagging plugin by Davy Mitchell and myself.
|||Blog statistics like these.|
A Few Bits of News
Ok, so this is a rubbish title for a blog entry. The alternative was me making all these snippets separate entries and thinking up witty and incisive titles for each one.
I've finally found out why the PyPy folks are working on an LLVM backend.
From Getting Started with PyPy :
The emphasis of the LLVM backend is to compile standalone executables.
My interest was piqued when I realised the LLVM compiled bytecode to C. This is very interesting (although hardly news to the rest of you I guess...).
Google Summer of Code
The PSF Google Summer of Code Projects have been announced. They're even more exciting than last year.
There is a good mix of "domain specific" projects, and ones of general interest. Particularly interesting ones include :
- The Decimal Module being implemented in C
- Improvement to the Pdb Debugger
- Improving the Zipfile module
- Adding an array datatype. This is a first step to moving some of Numarray into Python
Other slightly more esoteric projects include :
- Enhancing ShedSkin, the Python to C++ compiler.
- Work on a PyPy CLI backend (for .NET).
It looks like both Shedskin and PyPy are scarily close to becoming useful projects.
Slightly worrying is the project to integrate cheesecake with the cheeseshop. This seems to add extra hoops for package creators to jump through. (On top of the setuptools overhead we're already acquiring.) For example, from a naive reading, it looks like packages that use doctests rather than unittests will be penalised.
The cheesecake team assure me that doctests will be supported. I should have guessed.
One Laptop Per Child
There is an interesting pledge at the Pledge Bank, with lots of people committing to buy one for $300. That's only if they are made available commercially of course.
The point of the pledge is both to support the project, and to encourage them to make it available to buy.
You will be delighted to know that Python is used extensively in the project, particularly in the user interface IIUC.
After my recent experiences with bluetooth, it was with some trepidation that I bought a Linksys Compact Wireless G Router.
This gives me wireless networking and as a router, is a first step to a home network. But how much of a nightmare would it be to get it working ?
Amazingly it worked first time. NTL, for all their administrative incompetence, make it very easy to connect via a router and setting up the Linksys device (including encrypting and protecting the wireless network) was extremely easy. Phew.
ResolverSystems is looking to hire a senior developer. The main qualification is the ability of the candidate to fit in with our development methodology.
Previous knowledge of Python is not a requirement. Why not ? Well, the other developers (none of whom used Python prior to this project, other than me of course) have found Python so straightforward that they think any competent programmer can learn Python in a matter of days.
Firedrop On the Move
There are now two more developers actively working on Firedrop2, the blog program. There ought to be several new plugins and other improvements soon.
In fact the main reason for this blog entry was to test the code currently in the subversion repository.
If you're reading this, then it works fine.
IronPython & Windows Forms, Part III
This article has moved.
You can find the whole tutorial series at IronPython & Windows Forms.
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.