Tkinter Text Widget Tag Problem

Ivica Munitic imunitic at dijana.vest.hr
Sat Jul 6 08:05:58 EDT 2002


Hello boys and girls :)))
I have a question about the Text widget in Tkinter.
I have a link tag called hlink in my class(self.text.tag_configure("hlink",
foreground="blue")), and a alink when i go over a link with the mouse pointer
self.text.tag_configure("alink", underline=1, foreground="red"). The problem
is when two links are to close to each other then the <Leave> event 
never occures. I have a <Enter> and <Leave> methods.

def onEnter(event):
	start, end = self.text.tag_prevrange("hlink",
		self.text.index("@%s,%s" % (event.x, event.y)))
	self.text.tag_add("alink", start, end)
	self.start, self.end = start, end
def onLeave(event):
	self.text.tag_remove("alink", self.start, self.end)

When two links are positioned like this:
link1
link2

the Leave event of the first one never occurs if i go down with the cursor
from link1 to link2. But when i move the cursor away form the the links 
the Leave method occurs, and I get back the blue foreground with no underline.

Can any one tell me how to resolve this problem.
Tnx in advance!!



More information about the Python-list mailing list