Thank Michael Lange! it's what i need, and it works fine in twm no wonder python is so popular these days