[Tkinter-discuss] Creating a tag, and setting a margin

Michael O'Donnell michael.odonnell at uam.es
Tue Jul 8 10:08:29 CEST 2008


On Tue, Jul 8, 2008 at 8:59 AM, Alexnb <alexnbryan at gmail.com> wrote:
>
> Okay, this may sound noobish, but I just cannot figure this out. I am trying
> to set a tag in a Text widget of mine, but I don't know how and I am also
> trying to set a margin for the tag, but I have no clue how to do either!

from Tkinter import*

root = Tk()
twgt=Text(root)
twgt.pack(expand=True, fill=BOTH)
twgt.insert(END, "This text has no margin.\n\n")
twgt.insert(END, "This text has a margin.\n\n", ("marg"))
twgt.insert(END, "This text has no margin.\n\n")
twgt.tag_config("marg", lmargin1=15, lmargin2=15)
root.mainloop()


More information about the Tkinter-discuss mailing list