tkinter text editor

James Stroud jstroud at mbi.ucla.edu
Thu Mar 8 21:18:09 CET 2007


Gigs_ wrote:
> jim-on-linux wrote:
> 
>> On Friday 09 March 2007 12:04, Gigs_ wrote:
>>
>>> Gigs_ wrote:
>>>
>>>> I'm writing text editor.
>>>>
>>>> How to enable/disable (cut, copy etc.) when
>>>> text is selected/not selected
>>>
>>> Btw it is cut copy ... in edit menu
>>
>>
>>
>> state = 'diabled'   ## no change allowed
>>                            ## to Text Wiget 
>> state = 'normal'  ## default for Text Wiget
>>
>> jim-on-linux
>> http:\\www.inqvista.com
> 
> yes man but i want to make that when there is no selected text this menu 
> items go DISABLED and when text is selected this menu items go NORMAL

You have to methodically determine on an event by event basis what is 
going to cause selection and what isn't, then update the menus 
accordingly. It takes a lot of testing. An alternative is polling 
whether text is selected at the moment but is a waste of CPU cycles and 
is unnecessary.

Best is to let the system clipboard handle copy-paste as it was designed 
to do. You are opening a can of worms trying to micromanage your 
application.

James



More information about the Python-list mailing list