What graphics package are you using? The one that comes standard with Python is TkInter, so I would assume that one, but if you are using a different one the answer will be different. Also, the version of Python you are using would help as well.
Assuming TkInter and Python 3.x, a simple answer can be found in the first reply here. This should be easy to adapt to Python 2.x, as well.