On Mon, 2005-21-03 at 01:49 -0300, Eric Jardim wrote:
> On Sun, 20 Mar 2005 20:08:59 -0800, Brian <[EMAIL PROTECTED]> wrote:
> > This code does not always work as expected.  This is due to the
> > new_window_state and changed_mask possibly having more than one flag
> > attached.  The event.new_window_state and event.changed_mask are
> > enumerated data types.
> 
> Hmm,  that is right. You may have to change the '==' tests to a
> bitwise 'and' comparison:
> 
> (...)
> >>> if state & gdk.WINDOW_STATE_ICONIFIED:
> >>>    window.set_title('Iconified')
> (...)
> 
> If you just want to have a flag to know that it is iconified you can
> do something like:
> 
> class MyWindow(GtkWindow):
>     def __init__(self):
>         self.minimized = False
>         ...
> 
>     def new_window_state(self, widget, event):
>         state = event.new_window_state
>         if state & gdk.WINDOW_STATE_ICONIFIED:
>             self.minimized = True
>         else
>             self.minimized = False
> 
> I think that what you want to do is simple, so do not complicate it :)
> 
> [Eric Jardim]

That's better.  I knew there had to be an easy way.  I just was not
finding it.  In fact I googled the hell out of it but could not find
anything that listed comparison operators for it.

Thanks again
-- 
Brian <[EMAIL PROTECTED]>

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to