How do you do this in python with tk?

Eric Brunel eric_brunel at despammed.com
Tue Oct 12 10:01:28 CEST 2004


Ali wrote:
>>Setting state='disabled' does not only prevent the user from editing the text, 
>>but also prevents *you* from modifying the text via the insert or delete 
>>methods. So whenever you want to insert or delete lines in the text, you must 
>>configure its state to 'normal' before, do the modification, then set back its 
>>state to 'disabled'
>>
>>HTH
> 
> 
> OK so I tryed:
> 
> import Tkinter
> def add_rows(w, titles, rows):
>     t.state = 'normal'

tk options are not exposed as widget attributes, but via the configure method or 
dictionary-style indexing. So this should be:

w.configure(state='normal')

or:

w['state'] = 'normal'

What you did only creates a new attribute named "state" for the widget, which 
has no meaning at all at tk level.

[snip]

HTH
-- 
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com



More information about the Python-list mailing list