def Insert_Link (self): link = ttkSimpleDialog.askstring("Link", "Add link: ", initialvalue="https://") if link != None: text = ttkSimpleDialog.askstring("Text", "Add some text: ", initialvalue="Link text") if text != None: toAdd = "<a href="+ link + ">" + text + "</a>" self.HTML_box.insert(INSERT, toAdd)
def Insert_Image (self): image_name = filedialog.askopenfilename() if image_name != "": alt_text = ttkSimpleDialog.askstring("Link", "Add link: ", initialvalue="Alt Text") if image_name.endswith(".png") or image_name.endswith(".gif")\ or image_name.endswith(".jpg"): toAdd = '<img src="' + image_name + '" alt="' + alt_text + '" >' self.HTML_box.insert(INSERT, toAdd)
def Insert_Font_Size (self): size = ttkSimpleDialog.askstring("Size", "Add font size (px, em, %): ", initialvalue="1.5 em") if size != None: toAdd = "font-size: " + str(size) + ";" self.HTML_box.insert(INSERT, toAdd)
def Insert_Font (self): font = ttkSimpleDialog.askstring("Font", "Add a font : ", initialvalue="Courier New") if font != None: toAdd = "font-family: " + str(font) + ";" self.HTML_box.insert(INSERT, toAdd)