This dungeon generator is pretty basic. I know there are far better algorithms but this one is very easy to understand, IMO, which makes it good for learning. I hope you can improve on it. I would love to see a more complex dungeon generator that builds more passages and rooms to fill up the space more effectively.
I would probably port this over to HTML5 before I tried it in Python (it's been years since I've used Python, and these days my dial-up connection is so pathetic that I'm lucky when I can download anything over 3MB without the download failing midway). I already have made a dungeon generator with that, although it's very different from this (mine was more of a grid of rooms with doors, while this is more like an actual Roguelike generator).
When I was doing C++ and OpenGL, I made the beginnings of a 3D Roguelike, but I did things a little differently -- randomly placed "cells" that connected to each other, to give a more interesting and perhaps cohesive layout to a dungeon. These cells were different shapes and sizes, and were made of different walls and scenic features, and were just connected to each other randomly. I'll see if I can dig up some screen shots from it, just for kicks.