def createPen(self, color, offset=None): """ Creates a pen of the color specified Args: color (QColor): color for the line to be set to offset (bool): if color should be offset or not. Since this is only two colors, this can be a boolean, rather than an index. """ pen = QPen() pen.setColor(color) total_line_space = self.length() + (2 * self.spacing()) if offset: pen.setDashOffset(self.length() + self.spacing()) pen.setDashPattern([self.length(), total_line_space]) pen.setWidth(self.width) return pen