Re: Tkinter: Missing the last piece of the puzzle

2008-02-27 Thread Russell E. Owen
In article 
<[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] wrote:

> Simon Forman wrote:
> > yes! check out 
> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/464635
> >
> > HTH,
> > ~Simon
> 
> Thanks, Simon. Looks like that will do it.
> 
> Actually, it looks like that will overdo it. I'll be setting File/Save
> to enabled after every keystroke. Ideally, I'd like to set my statuses
> when the user clicks the File option or types Alt-F. This makes me
> wonder if there's a "mixin" that could find this event. Hmmm.

Set an internal state variables "isChanged" based on the Text callback 
and only modify the menu if the variable is set.

It's trickier to detect "significant" changes vs insigificant ones. 
Personally I would not bother to go that far.

-- Russell
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: Missing the last piece of the puzzle

2008-02-24 Thread MartinRinehart


Simon Forman wrote:
> yes! check out http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/464635
>
> HTH,
> ~Simon

Thanks, Simon. Looks like that will do it.

Actually, it looks like that will overdo it. I'll be setting File/Save
to enabled after every keystroke. Ideally, I'd like to set my statuses
when the user clicks the File option or types Alt-F. This makes me
wonder if there's a "mixin" that could find this event. Hmmm.

Alternatively, could modify this code to NOT reset the modified flag,
so I only get called on the first modification. Hmmm.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: Missing the last piece of the puzzle

2008-02-23 Thread Simon Forman
On Feb 23, 9:00 am, [EMAIL PROTECTED] wrote:
> I have a simple editor built into my visual parser. It has a File menu
> with
> typical New, Open, Save, Save As ... options. I now know how to set
> the options [en/dis]abled and how to check the Text widget's modified
> flag.
>
> Now I want to [en/dis]able those options. Can I ask the text to notify
> me when the modified flag changes?

yes! check out http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/464635

HTH,
~Simon

> Can I set the statuses when the
> user clicks File, before the options are displayed? Do I need to
> create
> a checker on an independent thread that looks at the flag every few
> millis?
>
> (Tkinter deserves more respect. I've got a good-looking application
> growing quickly.)


-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter: Missing the last piece of the puzzle

2008-02-23 Thread MartinRinehart
I have a simple editor built into my visual parser. It has a File menu
with
typical New, Open, Save, Save As ... options. I now know how to set
the options [en/dis]abled and how to check the Text widget's modified
flag.

Now I want to [en/dis]able those options. Can I ask the text to notify
me when the modified flag changes? Can I set the statuses when the
user clicks File, before the options are displayed? Do I need to
create
a checker on an independent thread that looks at the flag every few
millis?

(Tkinter deserves more respect. I've got a good-looking application
growing quickly.)
-- 
http://mail.python.org/mailman/listinfo/python-list