Hi all,
Can someone tell me why I do not get a connection between the events and
the functions in the sample below.  GUI window appears OK, just no
connections seem to be made.
I am new to this so may be missing something fundamental. 
Thanks, 
Doug



file pgtest.glade
=================

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>

<glade-interface>

<widget class="GtkWindow" id="page">
  <property name="visible">True</property>
  <property name="events">GDK_KEY_PRESS_MASK</property>
  <property name="title" translatable="yes">PGtestWindow</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="default_width">640</property>
  <property name="default_height">480</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">True</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <signal name="destroy_event" handler="on_page_destroy_event" 
last_modification_time="Thu, 16 Mar 2006 12:57:33 GMT"/>

  <child>
    <widget class="GtkDrawingArea" id="drawingarea1">
      <property name="visible">True</property>
      <property name="events">GDK_KEY_PRESS_MASK</property>
      <property name="extension_events">GDK_EXTENSION_EVENTS_ALL</property>
      <signal name="key_press_event" handler="on_drawingarea1_key_press_event" 
last_modification_time="Thu, 16 Mar 2006 10:09:36 GMT"/>
      <signal name="destroy_event" handler="on_drawingarea1_destroy_event" 
last_modification_time="Thu, 16 Mar 2006 13:01:31 GMT"/>
    </widget>
  </child>
</widget>

</glade-interface>

file pgtest.py
==============
import gtk
import gtk.glade

def on_drawingarea1_key_press(widget):
   print "keypress"   

xml = gtk.glade.XML('pgtest.glade')
widget = xml.get_widget('drawingarea1')
#print type(xml)

xml.signal_autoconnect({
  "on_drawingarea1_key_press_event": on_drawingarea1_key_press,
  "on_page_destroy_event":gtk.mainquit
})

gtk.main()


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

Reply via email to