REPOST: Re: Pmw.ScrolledText: selecting a line?

Matthew Dixon Cowles matt at mondoinfo.com
Sun Dec 30 13:47:03 EST 2001


On Thu, 20 Dec 2001 12:27:52 -0700, Bob Greschke <bob at passcal.nmt.edu>
wrote:

>I can click on a point on the graph and get the ScrolledText field to
>jump to the corresponding line in the file with .yview(line number),
>but how (if possible) can I get the line to then also be 'selected'
>or 'highlighted' somehow so the user knows which line the point is
>associated with?

Dear Bob,
You can tag the appropriate line and configure the tag to highlight
the text. Here's a small example:

>>> from Tkinter import *
>>> import Pmw
>>> r=Tk()
>>> t=Pmw.ScrolledText(r)
>>> t.pack()
>>> t.insert(END,"one\ntwo\nthree\nfour\nfive\nsix\nseven\n")
>>> t.component("text").tag_add("standout","2.0","2.end")
>>> t.component("text").tag_configure("standout",background="yellow")

Regards,
Matt

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool1-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.berkeley.edu!ucberkeley!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: matt at mondoinfo.com (Matthew Dixon Cowles)
Newsgroups: comp.lang.python
Subject: cmsg cancel <HiJX7.4722$aH2.2181807 at ruti.visi.com>
Control: cancel <HiJX7.4722$aH2.2181807 at ruti.visi.com>
Date: Mon, 31 Dec 2001 01:43:21 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.HiJX7.4722$aH2.2181807 at ruti.visi.com>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774121 27193 211.57.49.2 (31 Dec 2001 04:48:41 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:48:41 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list