def mark(self, color="red"): self.marked = True for comp in self.comps: comp.xkwargs = {'fill' : 'pink'} mark_text = BlockText(container=self, position=(Pt(-.5,-.5)), text="%d" % self.id) self.comps.append(mark_text) self.display()
def add_text(self, header, text=''): lines = text.split('\n') block = BlockText(header, lines) self.blocks.append(block)
def handle_block_create_request(self, idx): block = BlockText('Created', ['Hi!']) self.blocks.insert(self.focus_idx, block) self.focus_idx = idx
circle_pos = Pt(.5, .5) circle = BlockArc(container=bP, width=.1, position=circle_pos) bP.comps.append(circle) bP.display() dot_pos = Pt(.25, .25) dot = BlockDot(container=bP, width=.1, position=dot_pos) bP.comps.append(dot) bP.display() text_pos = Pt(.7, .9) text_pi_x = 0 text_pi_y = -.1 text_box = BlockText(container=bP, text="text here:%s" % text_pos, position=text_pos) bP.comps.append(text_box) bP.display() do_off_page = True do_off_page = False if do_off_page: off_page_pos = Pt(100., 100.) off_page_box = BlockText(container=bP, text="Off page:%s" % (off_page_pos), position=off_page_pos) bP.comps.append(off_page_box) bP.display() mainloop()
position = Pt(pos_x, pos_y) tR = RoadTrack(tag="road_track", canvas=canvas, width=th_width, height=th_height, position=position, cv_width=width, cv_height=height, rotation=rotation) tR.display() text_pos = Pt(.9, .9) text_pi_x = 0 text_pi_y = -.1 text_box = BlockText(container=tR, text="text here", position=text_pos) tR.comps.append(text_box) tR.display() chk_pi_x = 0 chk_pi_y = -.1 chk_pos = Pt(text_pos.x + chk_pi_x, text_pos.y + chk_pi_y) chk_width = .05 chk_height = .05 ''' chk_pos = Pt(.5,.5) # HACK to see it chk_width = .5 chk_height = .5 ''' '''check_box = BlockCheck(container=tR, tag="check", width=chk_width, height=chk_height, position=chk_pos,