from gtk.gdk import Screen _w, _h = screen_size = Screen().get_root_window().get_size() def pixel_coords(x, y): """ Translate coordinates (x, y) with 0 <= x <= 1 and 0 <= y <= 1 to pixel coordinates using the screen size. """ return _w * x, _h * y