def draw(self): "draws text" self.update_font() self.ftext = ftext(self.paper, (self.x, self.y), self.xml_ftext, font=self.font, fill=self.line_color, justify=self.justify) self.ftext.draw() x1, y1, x2, y2 = self.ftext.bbox() self.item = self.paper.create_rectangle(x1, y1, x2, y2, fill='', outline='', tags=('text', 'no_export')) self.selector = self.paper.create_rectangle(x1, y1, x2, y2, fill=self.area_color, outline='', tags=('helper_a', 'no_export')) self.ftext.lift() self.paper.lift(self.item) self.paper.register_id(self.item, self)
def draw( self, redraw=False): "draws vertex with respect to its properties" if self.item: warn( "drawing vertex that is probably drawn", UserWarning, 2) x, y = self.x, self.y self.update_font() if not self.pos: self.decide_pos() # we use self.text to force undo when it is changed (e.g. when atom is added to OH so it changes to O) self.ftext = ftext( self.paper, (self.x, self.y), self.xml_ftext, font=self.font, pos=self.pos, fill=self.line_color) self.ftext.draw() # should we want a complete bbox? (yes only for atoms in linear form) if len( [x for x in self.molecule.get_fragments_with_vertex( self) if x.type=="linear_form" and x.properties.get('bond_length',0)>20]): complete = True else: complete = False x1, y1, x2, y2 = self.ftext.bbox( complete=complete) self.item = self.paper.create_rectangle( x1, y1, x2, y2, fill='', outline='', tags=('atom','no_export')) ## shrink the selector according to the font size and properties hack_y = self.font.metrics()['descent'] - 1 self.selector = self.paper.create_rectangle( x1, y1, x2, y2-hack_y, fill=self.area_color, outline='',tags=('helper_a','no_export')) if not redraw: [m.draw() for m in self.marks] self.ftext.lift() self.paper.lift( self.item) self.paper.register_id( self.item, self) self._reposition_on_redraw = 0
def draw( self): "draws text" self.update_font() self.ftext = ftext( self.paper, (self.x, self.y), self.xml_ftext, font=self.font, fill=self.line_color, justify=self.justify) self.ftext.draw() x1, y1, x2, y2 = self.ftext.bbox() self.item = self.paper.create_rectangle( x1, y1, x2, y2, fill='', outline='', tags=('text','no_export')) self.selector = self.paper.create_rectangle( x1, y1, x2, y2, fill=self.area_color, outline='', tags=('helper_a','no_export')) self.ftext.lift() self.paper.lift( self.item) self.paper.register_id( self.item, self)
def draw(self, redraw=False): "draws vertex with respect to its properties" if self.item: warn("drawing vertex that is probably drawn", UserWarning, 2) x, y = self.x, self.y self.update_font() if not self.pos: self.decide_pos() # we use self.text to force undo when it is changed (e.g. when atom is added to OH so it changes to O) self.ftext = ftext(self.paper, (self.x, self.y), self.xml_ftext, font=self.font, pos=self.pos, fill=self.line_color) self.ftext.draw() # should we want a complete bbox? (yes only for atoms in linear form) if len([ x for x in self.molecule.get_fragments_with_vertex(self) if x.type == "linear_form" and x.properties.get('bond_length', 0) > 20 ]): complete = True else: complete = False x1, y1, x2, y2 = self.ftext.bbox(complete=complete) self.item = self.paper.create_rectangle(x1, y1, x2, y2, fill='', outline='', tags=('atom', 'no_export')) ## shrink the selector according to the font size and properties hack_y = self.font.metrics()['descent'] - 1 self.selector = self.paper.create_rectangle(x1, y1, x2, y2 - hack_y, fill=self.area_color, outline='', tags=('helper_a', 'no_export')) if not redraw: [m.draw() for m in self.marks] self.ftext.lift() self.paper.lift(self.item) self.paper.register_id(self.item, self) self._reposition_on_redraw = 0