Every line of 'tkinter canvas text' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
143 def update_text(self): 144 pre_text = '%s pt, ' % round(self.font_size, 1) 145 post_text = "\n(anchor_x = " + self.anchor_variants[self.anchor_ind][1] 146 post_text += ", anchor_y = " 147 post_text += self.anchor_variants[self.anchor_ind][0] + ")" 148 new_txt = pre_text + self.string_alternatives[self.str_ind] + post_text 149 self.text.text = new_txt 150 151 anchor_x = self.anchor_variants[self.anchor_ind][1] 152 anchor_y = self.anchor_variants[self.anchor_ind][0] 153 self.text.anchors = (anchor_x, anchor_y) 154 155 self.text.font_size = self.font_size 156 self.text.pos = self.size[0] // 2, self.size[1] // 2 157 158 self.update()
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
45 def set_text(self, text, colour=FG_COLOUR): 46 self.delete("all") 47 self.create_text( 48 TEXT_POSITION, text=text, font=FONT, fill=colour)