[Tkinter-discuss] horizontal line in Text

Vasilis Vlachoudis Vasilis.Vlachoudis at cern.ch
Fri Jan 24 11:44:30 EST 2020


Thanks
That's the easiest from all, and for my purpose it works just fine

Vasilis



________________________________
From: Bryan Oakley [bryan.oakley at gmail.com]
Sent: Friday, January 24, 2020 16:04
To: Vasilis Vlachoudis
Subject: Re: [Tkinter-discuss] horizontal line in Text

What I've done in the past is insert a single newline, and then apply a tag that uses a one or two pixel tall font, and then a background color or a border. When you add a tag on a newline, the background and border is always drawn to the right margin and is adjusted as the window is resized, yielding what looks like a line.

def insert_hr(text, index):
    text.tag_configure("hr", font=("Times", -2), background="red")
    text.insert(index, "\n", "hr")
insert_hr(text, "2.0")

This is what it looks like on my mac:

[Screen Shot 2020-01-24 at 9.02.16 AM.png]

On Thu, Jan 16, 2020 at 7:14 AM Vasilis Vlachoudis <Vasilis.Vlachoudis at cern.ch<mailto:Vasilis.Vlachoudis at cern.ch>> wrote:
Hi all,

is it possible to draw a horizontal line in the Text() widget, something
like the <hr> in html, extending all over the widget.

Vasilis
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org<mailto:Tkinter-discuss at python.org>
https://mail.python.org/mailman/listinfo/tkinter-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20200124/d9e4c2fd/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2020-01-24 at 9.02.16 AM.png
Type: image/png
Size: 34929 bytes
Desc: Screen Shot 2020-01-24 at 9.02.16 AM.png
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20200124/d9e4c2fd/attachment-0001.png>


More information about the Tkinter-discuss mailing list