screen.py 272 B

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