modified for nogui if no tk