gui: slightly improved code

maybe more pythonic, at least using more python special features...