f



Copy To Clipboard Highlighted Text From Text Widget

I have a gui that has text widget and I want to be able to
copy to the clipboard the text that is highlighted or the
text widget's entire contents if no text is highlighted.
This line of code works for the highlighted text:

    text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)

However, this code will generate an exception if no text
is highlighted.  So here is what I come up with and it
works:

def copy_clipboard(self):
    try:
        text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
    except:
        text2copy = self.text.get()
    root.clipboard_clear()
    root.clipboard_append(text2copy)

My concern is whether or not this approach is acceptable.
Is it ok to let the exception occur or would it be better
to avoid it?  If the later, I would appreciate suggestions
on how to do that, I mean how to determine if any text is
highlighted without generating an exception.  My research
was not very fruitful.

-- 
<Wildman> GNU/Linux user #557453
May the Source be with you.
0
Wildman
3/22/2016 1:24:31 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

5 Replies
388 Views

Similar Articles

[PageSpeed] 48

On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list
<python-list@python.org> wrote:
> I have a gui that has text widget and I want to be able to
> copy to the clipboard the text that is highlighted or the
> text widget's entire contents if no text is highlighted.

Fortunately your code reveals that you're using "tk" here, but
otherwise, please state up-front which GUI library you're using; there
are quite a few.

> This line of code works for the highlighted text:
>
>     text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>
> However, this code will generate an exception if no text
> is highlighted.  So here is what I come up with and it
> works:
>
> def copy_clipboard(self):
>     try:
>         text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>     except:
>         text2copy = self.text.get()
>     root.clipboard_clear()
>     root.clipboard_append(text2copy)
>
> My concern is whether or not this approach is acceptable.
> Is it ok to let the exception occur or would it be better
> to avoid it?  If the later, I would appreciate suggestions
> on how to do that, I mean how to determine if any text is
> highlighted without generating an exception.  My research
> was not very fruitful.

You're trying to do one of two things:

1) Copy the selected text to the clipboard
2) If there isn't any, copy all the text.

So I would say yes, the basic layout of try/except to get the text is
perfect. However, DON'T use a bare "except:" clause. You'll get back a
specific exception; catch that instead. Other than that, sure, your
code looks fine.

ChrisA
0
Chris
3/22/2016 1:47:11 AM
On 2016-03-22 01:47, Chris Angelico wrote:
> On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list
> <python-list@python.org> wrote:
>> I have a gui that has text widget and I want to be able to
>> copy to the clipboard the text that is highlighted or the
>> text widget's entire contents if no text is highlighted.
>
> Fortunately your code reveals that you're using "tk" here, but
> otherwise, please state up-front which GUI library you're using; there
> are quite a few.
>
>> This line of code works for the highlighted text:
>>
>>     text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>>
>> However, this code will generate an exception if no text
>> is highlighted.  So here is what I come up with and it
>> works:
>>
>> def copy_clipboard(self):
>>     try:
>>         text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>>     except:
>>         text2copy = self.text.get()
>>     root.clipboard_clear()
>>     root.clipboard_append(text2copy)
>>
>> My concern is whether or not this approach is acceptable.
>> Is it ok to let the exception occur or would it be better
>> to avoid it?  If the later, I would appreciate suggestions
>> on how to do that, I mean how to determine if any text is
>> highlighted without generating an exception.  My research
>> was not very fruitful.
>
> You're trying to do one of two things:
>
> 1) Copy the selected text to the clipboard
> 2) If there isn't any, copy all the text.
>
> So I would say yes, the basic layout of try/except to get the text is
> perfect. However, DON'T use a bare "except:" clause. You'll get back a
> specific exception; catch that instead. Other than that, sure, your
> code looks fine.
>
It'll raise TclError.

0
MRAB
3/22/2016 2:01:53 AM
On Tue, 22 Mar 2016 02:01:53 +0000, MRAB wrote:

> On 2016-03-22 01:47, Chris Angelico wrote:
>> On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list
>> <python-list@python.org> wrote:
>>> I have a gui that has text widget and I want to be able to
>>> copy to the clipboard the text that is highlighted or the
>>> text widget's entire contents if no text is highlighted.
>>
>> Fortunately your code reveals that you're using "tk" here, but
>> otherwise, please state up-front which GUI library you're using; there
>> are quite a few.
>>
>>> This line of code works for the highlighted text:
>>>
>>>     text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>>>
>>> However, this code will generate an exception if no text
>>> is highlighted.  So here is what I come up with and it
>>> works:
>>>
>>> def copy_clipboard(self):
>>>     try:
>>>         text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>>>     except:
>>>         text2copy = self.text.get()
>>>     root.clipboard_clear()
>>>     root.clipboard_append(text2copy)
>>>
>>> My concern is whether or not this approach is acceptable.
>>> Is it ok to let the exception occur or would it be better
>>> to avoid it?  If the later, I would appreciate suggestions
>>> on how to do that, I mean how to determine if any text is
>>> highlighted without generating an exception.  My research
>>> was not very fruitful.
>>
>> You're trying to do one of two things:
>>
>> 1) Copy the selected text to the clipboard
>> 2) If there isn't any, copy all the text.
>>
>> So I would say yes, the basic layout of try/except to get the text is
>> perfect. However, DON'T use a bare "except:" clause. You'll get back a
>> specific exception; catch that instead. Other than that, sure, your
>> code looks fine.
>>
> It'll raise TclError.

Thanks, that saved me some research time.

-- 
<Wildman> GNU/Linux user #557453
"It is a dangerous notion that we need a
government to protect us from ourselves."
  -Ron Paul
0
Wildman
3/22/2016 3:31:00 AM
On Tue, 22 Mar 2016 12:47:11 +1100, Chris Angelico wrote:

> On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list
> <python-list@python.org> wrote:
>> I have a gui that has text widget and I want to be able to
>> copy to the clipboard the text that is highlighted or the
>> text widget's entire contents if no text is highlighted.
> 
> Fortunately your code reveals that you're using "tk" here, but
> otherwise, please state up-front which GUI library you're using; there
> are quite a few.

Noted.

>> This line of code works for the highlighted text:
>>
>>     text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>>
>> However, this code will generate an exception if no text
>> is highlighted.  So here is what I come up with and it
>> works:
>>
>> def copy_clipboard(self):
>>     try:
>>         text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>>     except:
>>         text2copy = self.text.get()
>>     root.clipboard_clear()
>>     root.clipboard_append(text2copy)
>>
>> My concern is whether or not this approach is acceptable.
>> Is it ok to let the exception occur or would it be better
>> to avoid it?  If the later, I would appreciate suggestions
>> on how to do that, I mean how to determine if any text is
>> highlighted without generating an exception.  My research
>> was not very fruitful.
> 
> You're trying to do one of two things:
> 
> 1) Copy the selected text to the clipboard
> 2) If there isn't any, copy all the text.

Yes, that is exactly it.

> So I would say yes, the basic layout of try/except to get the text is
> perfect. However, DON'T use a bare "except:" clause. You'll get back a
> specific exception; catch that instead. Other than that, sure, your
> code looks fine.
> 
> ChrisA

Thanks.  I changed the code as you (and MRAB) suggested.

def copy_clipboard(self):
    try:
        text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
    except tk.TclError:
        text2copy = self.text.get()
    root.clipboard_clear()
    root.clipboard_append(text2copy)

Works perfectly.  Thanks again.

-- 
<Wildman> GNU/Linux user #557453
"Our country's founders cherished liberty, not democracy."
  -Ron Paul
0
Wildman
3/22/2016 3:36:22 AM
On Tue, Mar 22, 2016 at 2:36 PM, Wildman via Python-list
<python-list@python.org> wrote:
> Thanks.  I changed the code as you (and MRAB) suggested.
>
> def copy_clipboard(self):
>     try:
>         text2copy = self.text.get(tk.SEL_FIRST, tk.SEL_LAST)
>     except tk.TclError:
>         text2copy = self.text.get()
>     root.clipboard_clear()
>     root.clipboard_append(text2copy)
>
> Works perfectly.  Thanks again.

Looks good!

For future reference, and for others reading, this was a great
question. You posted actual code, with a specific question, and it was
easy to figure out what's going on. Thank you.

ChrisA
0
Chris
3/22/2016 3:46:16 AM
Reply:

Similar Artilces:

highlight text in text widget
Hi, I am trying to make widget that displays text. I also want a search keywords available. The way I have envisioned is something similar to emacs search, i.e. it highlights all the occurrences of the keyword that you are interested in. I am trying to find out if that kind of highlighting be done in widget_text or some other widgets. Can anyone help? Thanks neon writes: > I am trying to make widget that displays text. I also want a search > keywords available. The way I have envisioned is something similar to > emacs search, i.e. it highlights all the occurrences of the keyword &g...

text in a widget, text-widget
hello i have an application with a couple of text widgets but i would like to add some functionalities that at first and second sight are not directly supported by the plain text widget itself - ? for example i would like certain lines of text within the textwidget to take different background colors according to certain parameters also i would like to be able to detect certain sentences or words that would become 'links' and by clicking them i would open up different windows any suggestions to solutions and widgets for the above problems ? - i probably could...

text + text
What is "text + text" supposed to do right now? It doesn't seem very useful to me. What about making "text + text" as an equivalent for "text || text"? Most strongly-typed programming languages do this. And MS SQL Server too, I think (CMIIW). -- dave ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond: > What is "text + text" supposed to do right now? Nothing. > What about making "text + text" as an equivalent for "text > || text"? Most strongly-typed programming languages do this. And MS SQL > Server too, I think (CMIIW). What would this gain except for bloat? It's not like SQL is utterly compatible with any programming language; users will still have to learn all the operators anyway. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match Peter Eisentraut wrote: >>What is "text + text" supposed to do right now? > > Nothing. Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly, the current behaviour is quite strange to me. ------------------ =...

text-text
Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ...

Re: text in a widget, text-widget @ 1145998849
Intrah onat Diria .. Tue, 25 Apr 2006 13:55:44 -0700 , ****** wrote "Revera y": > of "unsubscribe ptk" to majordomo@lists.stanford.edu > If you wish to unsubscribe from this mailing list, send the message body > This message was posted through the Stanford campus mailing list server. > ++**=3D=3D > -++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--= > > > > > ,=20 > , _________________ > , |---| > , | > , lead > , ::::::opthe > , oo,loent,uaha > , }, > ,...

Clipboard
<html> <head> <title></title> <script language="javascript" type="text/javascript"> <!-- // Copyright (C) krikkit - krikkit@gmx.net // --> http://www.krikkit.net/ // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. function copy_clip(txtObjId) { meintext = document.getElementById(txtObjId).value; if (window.clipboardData) { // ...

text widget: loading dumped text?
Is there an easy way to reload information dumped from a text widget? I'm trying to reproduce and report a bug in the text widget and this would help a lot. -- Russell P.S. the bug is that in Aqua 8.4.15 if I scroll to the top of the text widget while some text is elided, often a few lines that *should* be displayed are simply blank. It's fairly reproducible but the data is rather complex. Russell E. Owen wrote: > Is there an easy way to reload information dumped from a text widget? > I'm trying to reproduce and report a bug in the text widget and this > would help a lot. > > -- Russell > > P.S. the bug is that in Aqua 8.4.15 if I scroll to the top of the text > widget while some text is elided, often a few lines that *should* be > displayed are simply blank. It's fairly reproducible but the data is > rather complex. What do you mean by "dumped"? Saved? -- Kevin Walzer Code by Kevin http://www.codebykevin.com Russell E. Owen wrote: > Is there an easy way to reload information dumped from a text widget? > I'm trying to reproduce and report a bug in the text widget and this > would help a lot. > It's possible to write code to do this, but there's nothing built-in to Tk or available in tklib. -- Bryan Oakley http://www.tclscripting.com Russell E. Owen wrote: > Is there an easy way to reload information dumped from a text widget? > I'm trying to reproduce and repo...

redirect text to file; text widget
I've loaded text from a file into the text widget, and having edited it would like to redirect it back into a file, but haven't found a handle for it. If there was an attribute such as the "-textvariable" option for the entry and label widgets, I could echo it into a file from another widget (button, etc). Thanks ..t get 0 end "John Peters" <john@jpeters.net> wrote in message news:20060701143102.70526542.john@jpeters.net... > > I've loaded text from a file into the text widget, and having edited it > would like to redirect it back into a file, but haven't found a handle for > it. If there was an attribute such as the "-textvariable" option for the > entry and label widgets, I could echo it into a file from another widget > (button, etc). Thanks Usman, Your solution is incorrect. The first character in a text index is 1.0, not 0. Usman Muzaffar wrote: > .t get 0 end > > "John Peters" <john@jpeters.net> wrote in message > news:20060701143102.70526542.john@jpeters.net... > >>I've loaded text from a file into the text widget, and having edited it >>would like to redirect it back into a file, but haven't found a handle for >>it. If there was an attribute such as the "-textvariable" option for the >>entry and label widgets, I could echo it into a file from another widget >>(button, etc). Thanks > > >...

Highlight text and Text Box Control
C5.0b PE legacy Hello! I have one invoice application with the text area for variable customer announcement. It is now filled and printed using the standard Arial characters. Is there any easy and cheap method to highlight these messages? (Compare "Word text") TIA Riku Maki ...

Replace text with image in text widget
I'm trying to replace an emoticon with an actual image in a text widget. I know I'm not doing this correctly: the sample code below inserts two images randomly and seems to garble the text in other ways. The idea is to have two emoticons (one on each line) and replace them with an image, nothing more. Can anyone take a look and suggest how I might get this to work? Thanks. --- SPfHZvvOGvfQEvfGdvjQE/rNMfrOMfrNPfvQHfzQHfjQLfrNRvjQL/vRJfzRJvrOWvbMh/3VHPfM h/3WHPzVMP7XF/zVMfrPdv7YGP7YG/7YHPzWPPzWPfvUVP7ZHf7ZIPvWVf7aJv7aJ/7bJv7bM/7b NP7cLf7dMPvXeP7dNvrVlv7eOPrWlvvaevrYmP7gRP7gRf7gRv7iTf7iWf7jUf3hav7jVv7jV/7k YP7lYfzioPzjn/zjoP7ocvzkoP7oc/7pcf7pcvzlp/7pe/7pfP3mp/7si/7tjf/tkf/tkv7uj/3r tf3stf/voP/vo//woP/wof/wpf/wp/7xuf7xvP/zqv7xwf/zq/7yuf/zsP/zsf/zsv7yv//zs/7y xP/zuf/zu//1vP70zv/2vP/2wv/2w//3wv/20P/3zf/3zv/30P/4zv/5z//51P/51f/61f/61v/5 4v/63v/64v/73//85v/85//87f/87v/98v/+9v////////////////////////////////////// /////////////////////////////////////////////////////yH+GkNyZWF0ZWQgd2l0aCBH SU1QIG9uIGEgTWFjACH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHEiwoMGDA3cUMfID4UEZVlBB+/YN miosNxwKHAIrXLlz6NCdMxduVhKHQXJVs7YN3Dhy4rhdw6bryMEYqYL9QiYtWzdv2qYtA2aMFQ6D YIg5s9Xr2DNq1KIl83WrGTM3BU9YEsYrFq0ID4YVczChlqxdyjaxIAhj0ahQplYZGIALl4ADrU6F GuWoBsEZcwRJ6kQKiA9Xr3oAKfVpEiE6OQi+4GLnz6NLnUCJEgXKUyZIge58oUEQRRU2FeAcekSp UiVKkRDJobDmiguCJJ6QgaKgySBGjRoxMtRkQZQxUkoQBEGECxshBBho4MGDQ4MCQth4QRKCYAYb U8JosNGDIUEAAAgw4GEThoqODQVFMMkiBg2bPYkU8XmDRkwXJyMclIIWaZhxRhlkkFHGGWa0scUK CEGgghqF9JFHHXXk0UchcbQggU...

How to highlight in a text widget
I'm having diffuculty finding out how to select/highlight a word in a text widget. How is this done? Thanks, Phil Phil Biehl wrote: > I'm having diffuculty finding out how to select/highlight a word in a text > widget. > > How is this done? > > Thanks, > Phil > > The special tag "sel" is used for the selection: .text tag add sel $start $end If you want to highlight with your own colors, do something like this: .text tag configure red -background red -foreground white .text tag add red $start $end Bryan, That worked perfectly. I know that the man pages are our friends but sometime they seem like distant friends... Sometimes it's hard to find exactly what one is looking for. Thanks for your help! Phil "Bryan Oakley" <oakley@bardo.clearlight.com> wrote in message news:ub2se.1037$kX4.257@newssvr30.news.prodigy.com... > Phil Biehl wrote: >> I'm having diffuculty finding out how to select/highlight a word in a >> text widget. >> >> How is this done? >> >> Thanks, >> Phil > > The special tag "sel" is used for the selection: > > .text tag add sel $start $end > > If you want to highlight with your own colors, do something like this: > > .text tag configure red -background red -foreground white > .text tag add red $start $end ...

Using Control-a to select all text in a text widget
I'm having a difficult time binding Control-a so it selects all the text in a widget just like the default Control-/ binding does. I've tried: ..t bind <Control-a> [.t bind <Control-/>] But [.t bind <Control-/>] returns nothing. If I do: ..t bind <Control-/> {puts "Selecting all"} ..t bind <Control-a> [.t bind <Control-/>] When I hit Control-/ I get at the prompt "Selecting all" and all the text is selected. But when I hit Control-a all I get is the "Selecting all" at the prompt and no text is selected. I've also tried: ..t bind <Control-a> {.t tag add sel 1.0 end} And that doesn't work either. In fact, with this code if you do Control-/ and then Control-a it unselects everything. And dumping the tags for the entire region show the tagon/tagoff for sel are gone. Does anyone know the semantics of Control-/? There's got to be more to it. - Ian I've just found this thread: http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/5c1df73696e94962/38ec894e32bafcd2?lnk=gst&q=select+all&rnum=8#38ec894e32bafcd2 Which seems to suggest there's nothing fancy about Control-/. - Ian And to answer my own question, the following works: bind .t <Control-a> {%W tag add sel 1.0 end; break;} - Ian On Wed, 01 Aug 2007 16:54:06 -0000, sniff.scratch@gmail.com wrote: >I'm having a difficult time binding Control-a so it selects all the >text in a w...

how to change foreground color of text in text widget
hi, i have a program in which i am reading from a file and displaying contents of file in a text widgets now on a particular event i read one line of text widget & i need to change color of that line same as it occurs during debugging a program what i feel a tag has to be created suppose .t is my text widget ..t tag configure color1 -foreground red now how do i change color of the line which i have read and how to use this tag if so now i am able to do that what i did is while inserting line in text widget i added diff tag names to each line and while reading each line i configured tag of that line with diff color ...

How do I Copy an error message to a text document, as text?
How do I Copy an error message to a text editor document (BBEdit, to be specific) as just plain text (what I see in the notebook cell)? I think I've now tried every possible Copy and Copy As . . . option in the Mac front end menus for Mathematica 4.2, with the text selected and with the cell bracket selected; and every one of them (fourteen cases in all) gives me a messy version of the error message with a bunch of formatting markup stuff inserted. Frustrating!!! Seigman: Yasvir was correct in copying Input and Output Forms to plaintext. However, that is not the M...

How to convert markup text to plain text in python?
I have some marked up text and would like to convert it to plain text, by simply removing all the tags. Of course I can do it from first principles but I felt that among all Python's markup tools there must be something that would do this simply, without having to create an XML parser etc. I've looked around a bit but failed to find anything, any tips? (e.g. convert "<B>Today</B> is <U>Friday</U>" to "Today is Friday") Regards, Geoff > I have some marked up text and would like to convert it to plain text, > by simply removing all th...

Musatov exposes R.S.A. vulnerability: Blue highlight black text truncates black background text turning it white black foreground text remains in field.
505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f7071 72737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969 798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3 505152535455565758595a5b5c5d5e5f606162HMAC/SHA-256 Large Correct: Superposition of lines 1 and 4 will correct R.S.A. example: http://il8n.co/test.html ...

Copy Text in Minbuffer to clipboard
Hello All: using emacs 21.2.1 on RH 9.0 For the life of me, I can't seem to be able to copy text displayed in the minibuffer. Example: Click Help->Show Emacs Version version is displayed in minibuffer. When I click on the text to copy it to the X clipboard, the text just disappears. How may I copy this text? Pointers to docs are welcome, obviously I'm a newbie. Thanks tim -- Tim Johnson <tim@johnsons-web.com> http://www.alaska-internet-solutions.com On Sat, Nov 08 2003, Tim Johnson wrote: > For the life of me, I can't seem to be able to cop...

Surrounding text with text
I was wondering if it was possible to surround a text body with text like so: +--------------+ |ABCDEFGHIJKLM | |H N| |A Main Body O| |L Text goes P| |B here Q| |-=+_ZYXWVUTSR | | | | | | | | | +--------------+ This seems far-fetched, but just curious. I suppose that I could just move stuff around by hand in the GIMP later on, but there's probably a {better,more {extensible,clean}} way of doing it from (La)TeX. -FreeSmith ptjm@interlog.com (Patrick TJ McPhee) wrote in message news:<bffbhe$per$1@news.eusc.inter.net>... > Peter Flynn had an example like that, which he either posted here or > posted a link here. It was something to do with a certificate -- try > searching for his name and that word in google. > > It wouldn't be hard to do with metapost. I have a macro called `pathalong' > which puts text along an arbitrary path. Well, it's been a while, but I finally finished it. It's a little job I was doing for an upcoming wedding. At any rate, I used pstricks to make the text go along a path, along with a couple of hacks for sizing (from graphicx) and kerning along the line (from soul). Here's the code (don't laugh): CAUTION:THIS CODE MAY MAKE YOU WRETCH ---SNIP--- \documentclass{article} \usepackage{graphicx} \usepackage{pstricks,pst-text,nopageno} \usepackage[width=8.5in]{geometry} \usepackage{soul} \begin{document} \thispagestyle{empty} \set...

Highlight but no entry in text widget
Hi, I'd like to know if it's possible to prevent text being added to a text widget but still allow the highlighting of text for cut and paste. The method I use is this. Whenever the mouse is clicked within the text widget I shift the focus somewhere else. This prevents editing within the widget. Unfortunately it also prevents the highlighting of text (only under windows though, it works ok under Unix). I don't use -state disable because this prevents text being entered into the widget by the program as well. Can you help? Thanks in advance. "Mike Parry" <mike.parry@asyst.freeserve.co.uk> wrote in message news:49fd7d77.0406031134.cc0d084@posting.google.com... : Hi, : : I'd like to know if it's possible to prevent text being added to a : text widget but still allow the highlighting of text for cut and : paste. : : The method I use is this. Whenever the mouse is clicked within the : text widget I shift the focus somewhere else. This prevents editing : within the widget. Unfortunately it also prevents the highlighting of : text (only under windows though, it works ok under Unix). : : I don't use -state disable because this prevents text being entered : into the widget by the program as well. Mike: Two things... First, I typically *do* disable the text widget if I want it to be read-only. You are correct in that it prevents text from being programmatically entered, but this is easily handled via some sort of insert proc. Ju...

Copy images and text to clipboard
Hi. I have a web page that has images and text. I can carefully select one image and the on the right of the image and then copy & paste to Word. Is it possible to make javascript do the same: select the same area (divided by <div> tag) and copy to clipboard? So far I succeeded to make the script to copy the area inside <div> but it was plain html-text. The idea is to have tha data in clipboard so one can paste it to Word remaining the layout like it is in html-file. Here's what I have now in my html-file: .... <script> function copyToClipboard() { var x...

Copying from text widget to shell
Hi, I'm attempting to develop a small application using Tcl 8.4/Tk 8.4 and I have a few questions about the text widget. I need to be able to copy the text from the text widget to another window (UNIX shell) either using Tcl copying commands or basic mouse commands. However, I've been unable to do so. Does anyone know if I can copy text from a text widget into a separate window? Copying from one text-widget to another of an other application works. I found some similar problems in this newsgroup, but no resolution for this problem. Thanks in advance for your help. Hi MAK, "MAK" writes: > I need to be able to copy the text from the text widget to another > window (UNIX shell) either using Tcl copying commands or basic mouse > commands. However, I've been unable to do so. The command to paste into an XTerm is pressing the middle mouse button (that is the scroll wheel on modern mice). Have you tried that? If that doesn't work, you may also want to try the right mouse button, because sometimes meaning of the mouse buttons is reordered in the X11 setup. <nitpicking> That window is a "terminal". The "shell" is just running inside that terminal and doesn't know anything about cut-and-paste. But the terminal handles that for the shell. </nitpicking> benny Thanks for your help. Pressing the middle or the right mouse button does not work. Ctrl + v does not work as well. What do you mean with th...

copying text to the system clipboard
Hi all, is it possible to copy text from an IDL variable to the system clipboard? Specifically, I would like to copy a string array into a multi-line text which can be pasted into Notepad or wherever. I found David's 'clipboard' routine, which does it for graphics windows. Thanks for your help, Benjamin Benjamin Hornberger wrote: > is it possible to copy text from an IDL variable to the system > clipboard? Specifically, I would like to copy a string array into a > multi-line text which can be pasted into Notepad or wherever. > > I found David's 'clip...

How to copy error text to the clipboard?
How does one copy to the clipboard the text of an error message that appears in the error window, e.g., errors that occur in the overall system when harvesting (or sending) e-mail? One can select (highlight) the error message by clicking on it, but Ctrl-C does not copy the selected message to the clipboard. One cannot select portions of the text in the message; only the entire error message highlights. If one right-clicks on a selected error message one gets "No help topic is associated with this item" or similar wording, i.e., there is no right-click menu. This has be...

text 2 text
I'm rather new to ustation and am having trouble finding replacements for all of my Acad lisp routines. One that I'd like to find changes a selected text string to read like the second selected text string. I realize this can all be done in the text editor but it's not all that quick. Does anyone know of a macro or mdl which can handle this task? Thanks in advance.---Calvin I don't know of any application that will do what you describe, but have you looked at Edit > Find/Replace text? You may also find Bentley's discussion groups of assistance. Over there you can meet other users of Bentley products, exchange ideas, and discuss a wide range of technical subjects. These groups are an excellent technical resource for all users of Bentley products and services. Hope to see you there! For more information take a peek at this page: http://selectservices.bentley.com/discussion/index.htm -- Best Regards, Inga Morozoff [Bentley] www.askinga.com "jgonzales24" <jgonzales24@cox.net> wrote in message news:xcLMb.13975$zs4.2376@fed1read01... > I'm rather new to ustation and am having trouble finding replacements for > all of my Acad lisp routines. One that I'd like to find changes a selected > text string to read like the second selected text string. I realize this > can all be done in the text editor but it's not all that quick. Does anyone > know of a macro or mdl whi...

Web resources about - Copy To Clipboard Highlighted Text From Text Widget - comp.lang.python

File:Latah County Idaho Incorporated and Unincorporated areas Bovill Highlighted.svg - Wikipedia, the ...
This map shows the incorporated and unincorporated areas in Latah County , Idaho , highlighting Bovill in red. It was created with a custom script ...

Facebook gauges interest in new way to monetize users: ‘highlighted posts’
... PayPal, a credit card or Facebook Credits they have saved. The promoted post will appear at the top of friends’ News Feeds with the word “highlighted” ...

All sizes - 20110120-NodeXL-Twitter-Quantified Self Graph Highlighted Most Between User with tooltip ...
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Plight of the crab plover highlighted by study in Sharjah
With its contrasting black and white plumage and thin, long legs, the crab plover is a favourite for local bird watchers and a must-see for many ...

South-east Australia highlighted in global map of vegetation sensitive to climate change
Our crop lands, grasslands and woodlands, especially on the Great Dividing Range's inland slopes, may be in for tough times.

Refugee crisis highlighted in Africa film festival
Drawing a global audience, Nigerian cinema highlighting issues close to the society's heart.

UM Upper Chesapeake Health, Harford County institutions highlighted in Annapolis
Baltimore Sun UM Upper Chesapeake Health, Harford County institutions highlighted in Annapolis Baltimore Sun Maryland House Speaker Michael ...

Sanders on differences with Clinton highlighted in campaign ad - Videos - CBS News
Democratic presidential candidate Bernie Sanders joins “CBS This Morning” from Burlington, Vermont, to discuss his latest campaign ad that explains ...

W Magazine accidentally highlighted Hollywood’s diversity problems, right?
W Magazine has an annual feature to coincide with the big Oscar awards season. Many magazines do – like, Vanity Fair does their annual Hollywood ...

2016 BNP Paribas Open Highlighted By Return Of Williams Sisters & Affordable Ticket Prices
15 years have passed since Serena Williams claimed her second and last title at the Indian Wells Masters. While a championship win at the annual ...

Resources last updated: 3/22/2016 1:26:08 AM