Yes, that's it. calling win.show() before using width() solves the problem. Boy, it's been a long time since I've done GUI programming :-)