On Sat, 19 Mar 2005 22:40:54 -0800, Brian <[EMAIL PROTECTED]> wrote:
> I have been trying in vane to figure out the event that triggers the
> window_state_event callback.   The docs are as clear as mud!   I am
> trying to get the minimize and restore events so I can change the window
> title to the same as the statusbar message when the window is minimized.
> Then restore the title along with the window for normal viewing.

When PyGTK is not enough you can always apeal to the GTK+2.0 docs:
http://www.gtk.org/api/2.6/gtk/index.html
http://www.gtk.org/api/2.6/gdk/index.html

But in this case I think everything you need is in:
http://www.pygtk.org/pygtk2reference/class-gdkevent.htm

There it says:
"The attributes available for a gtk.gdk.Event are dependent on the
type of the event. The event types are described in the Description
section."

Look carefully at the gtk.gdk.WINDOW_STATE section..


> Does anyone know how to decipher the event passed to the callback for
> these to user actions?

You can always use a friendly "dir(event)" function. I did it and
discovered that there is a "new_window_state". There is also a
"change_mask", but I dont think it will help you.

Study and meditate on the code below and I think your questions will
be answered.

>>>>>>>>

import gtk
import gtk.gdk as gdk

def quit(data=None):
   gtk.main_quit()

def window_event(window, event):
   state = event.new_window_state
   if state == 0:
       window.set_title('Normal')
   elif state == gdk.WINDOW_STATE_ICONIFIED:
       window.set_title('Iconified')
   elif state == gdk.WINDOW_STATE_MAXIMIZED:
       window.set_title('Maximized')

window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect('destroy', quit)
window.connect('window-state-event', window_event)
window.set_title('Normal')
window.show()
gtk.main()

<<<<<<<<

You should also study this links:
http://www.gtk.org/api/2.6/gdk/gdk-Event-Structures.html#GdkWindowState

Hope helped,

[Eric Jardim]
_______________________________________________
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