def _draw_connectors(self): """ Draws the connectors on the proto board. """ for r in ROWS: for c in COLUMNS: if valid_loc((r, c)): self._draw_connector(*self._rc_to_xy((r, c)))
def _xy_to_rc(self, x, y): """ Returns the row and column of the valid location on the proto board containing the point (|x|, |y|), or None if no such location exists. """ for r in xrange(PROTO_BOARD_HEIGHT): for c in xrange(PROTO_BOARD_WIDTH): if valid_loc((r, c)): x1, y1 = self._rc_to_xy((r, c)) x2, y2 = x1 + CONNECTOR_SIZE, y1 + CONNECTOR_SIZE if x1 <= x <= x2 and y1 <= y <= y2: return r, c return None