sugar-toolkit-gtk3/sugar/graphics/grid.py
2006-10-01 19:08:26 +02:00

16 lines
334 B
Python

import gtk
COLS = 16
ROWS = 12
class Grid(object):
def __init__(self):
self._factor = gtk.gdk.screen_width() / COLS
def position(self, x, y):
return [x * self._factor, y * self._factor]
def rectangle(self, x, y, width, height):
return [x * self._factor, y * self._factor,
width * self._factor, height * self._factor]