Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 2:36 PM, Wildman via Python-list 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() > r

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Wildman via Python-list
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 > 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

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Wildman via Python-list
On Tue, 22 Mar 2016 02:01:53 +, MRAB wrote: > On 2016-03-22 01:47, Chris Angelico wrote: >> On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list >> 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

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread MRAB
On 2016-03-22 01:47, Chris Angelico wrote: On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list 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

Re: Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Chris Angelico
On Tue, Mar 22, 2016 at 12:24 PM, Wildman via Python-list 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"

Copy To Clipboard Highlighted Text From Text Widget

2016-03-21 Thread Wildman via Python-list
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 co