def draw(self, x, y, dc, styler): a, b = list(self.iter_boxes(0, x, y)) styler.set_style(promptstyle) n = self.number or '' dc.DrawText("In[%s]:" % n, x, a[3]) dc.DrawText("Out[%s]:" % n, x, b[3]) Box.draw(self, x, y, dc, styler)
def draw(self, x, y, dc, styler): Box.draw(self, x, y, dc, styler) w = self.width h = self.height w1 = 5 w2 = self.content.width+2 points = [ (x, y+h/2), (x+w1/2, y+h), (x+w1, y), (x+w1+w2, y), ] dc.DrawLines(points)
def responding_child(self, i, x0, y0): # Index position n+1 usually is managed by a child object. We # want the next object to be responsible, so we have to change # the return behaviour. if i == len(self): return None, i, x0, y0 # None => kein Kind kümert sich darum return Box.responding_child(self, i, x0, y0)
def draw_selection(self, i1, i2, x, y, dc): if i1 <= 0 and i2 >= self.length: self.device.invert_rect(x, y, self.width, self.height, dc) else: Box.draw_selection(self, i1, i2, x, y, dc)
def get_index(self, x, y): if y < 3: return 0 elif y >= self.height - 2: return len(self) return Box.get_index(self, x, y)
def extend_range(self, i1, i2): for i in (0, len(self)-1): if i1<= i<i2: return 0, len(self) return Box.extend_range(self, i1, i2)
def draw_selection(self, i1, i2, x, y, dc): if i1<=0 or i2>=len(self): self.device.invert_rect(x, y, self.width, self.height, dc) else: Box.draw_selection(self, i1, i2, x, y, dc)
def draw(self, x, y, dc, styler): Box.draw(self, x, y, dc, styler) h = self.denominator.height+self.denominator.depth dc.DrawLine(x, y+h, x+self.width, y+h)