title: how to display dialog using pygtk with glade
body: <p>I am trying create alert dailog using glade,but its not working .am i doing anything wrong here.</p>
  
  <p>test.glade :</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
  &lt;interface&gt;
    &lt;requires lib="gtk+" version="2.16"/&gt;
    &lt;!-- interface-naming-policy project-wide --&gt;
    &lt;object class="GtkWindow" id="window1"&gt;
      &lt;child&gt;
        &lt;object class="GtkVBox" id="vbox1"&gt;
          &lt;property name="visible"&gt;True&lt;/property&gt;
          &lt;child&gt;
            &lt;object class="GtkButton" id="hello"&gt;
              &lt;property name="label" translatable="yes"&gt;hello&lt;/property&gt;
              &lt;property name="visible"&gt;True&lt;/property&gt;
              &lt;property name="can_focus"&gt;True&lt;/property&gt;
              &lt;property name="receives_default"&gt;True&lt;/property&gt;
              &lt;signal name="clicked" handler="on_hello_clicked"/&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name="position"&gt;0&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
        &lt;/object&gt;
      &lt;/child&gt;
    &lt;/object&gt;
    &lt;object class="GtkDialog" id="dialog1"&gt;
      &lt;property name="border_width"&gt;5&lt;/property&gt;
      &lt;property name="type_hint"&gt;normal&lt;/property&gt;
      &lt;property name="has_separator"&gt;False&lt;/property&gt;
      &lt;child internal-child="vbox"&gt;
        &lt;object class="GtkVBox" id="dialog-vbox1"&gt;
          &lt;property name="visible"&gt;True&lt;/property&gt;
          &lt;property name="spacing"&gt;2&lt;/property&gt;
          &lt;child&gt;
            &lt;object class="GtkLayout" id="layout1"&gt;
              &lt;property name="visible"&gt;True&lt;/property&gt;
              &lt;child&gt;
                &lt;object class="GtkLabel" id="click"&gt;
                  &lt;property name="width_request"&gt;100&lt;/property&gt;
                  &lt;property name="height_request"&gt;80&lt;/property&gt;
                  &lt;property name="visible"&gt;True&lt;/property&gt;
                  &lt;property name="label" translatable="yes"&gt;process is not running&lt;/property&gt;
                &lt;/object&gt;
                &lt;packing&gt;
                  &lt;property name="x"&gt;99&lt;/property&gt;
                  &lt;property name="y"&gt;58&lt;/property&gt;
                &lt;/packing&gt;
              &lt;/child&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name="position"&gt;1&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
          &lt;child internal-child="action_area"&gt;
            &lt;object class="GtkHButtonBox" id="dialog-action_area1"&gt;
              &lt;property name="visible"&gt;True&lt;/property&gt;
              &lt;property name="layout_style"&gt;end&lt;/property&gt;
              &lt;child&gt;
                &lt;object class="GtkButton" id="button1"&gt;
                  &lt;property name="label"&gt;gtk-yes&lt;/property&gt;
                  &lt;property name="visible"&gt;True&lt;/property&gt;
                  &lt;property name="can_focus"&gt;True&lt;/property&gt;
                  &lt;property name="receives_default"&gt;True&lt;/property&gt;
                  &lt;property name="use_stock"&gt;True&lt;/property&gt;
                  &lt;signal name="clicked" handler="on_button1_clicked"/&gt;
                &lt;/object&gt;
                &lt;packing&gt;
                  &lt;property name="expand"&gt;False&lt;/property&gt;
                  &lt;property name="fill"&gt;False&lt;/property&gt;
                  &lt;property name="position"&gt;0&lt;/property&gt;
                &lt;/packing&gt;
              &lt;/child&gt;
              &lt;child&gt;
                &lt;object class="GtkButton" id="button2"&gt;
                  &lt;property name="label"&gt;gtk-no&lt;/property&gt;
                  &lt;property name="visible"&gt;True&lt;/property&gt;
                  &lt;property name="can_focus"&gt;True&lt;/property&gt;
                  &lt;property name="receives_default"&gt;True&lt;/property&gt;
                  &lt;property name="use_stock"&gt;True&lt;/property&gt;
                  &lt;signal name="clicked" handler="on_button2_clicked"/&gt;
                &lt;/object&gt;
                &lt;packing&gt;
                  &lt;property name="expand"&gt;False&lt;/property&gt;
                  &lt;property name="fill"&gt;False&lt;/property&gt;
                  &lt;property name="position"&gt;1&lt;/property&gt;
                &lt;/packing&gt;
              &lt;/child&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name="expand"&gt;False&lt;/property&gt;
              &lt;property name="pack_type"&gt;end&lt;/property&gt;
              &lt;property name="position"&gt;0&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
        &lt;/object&gt;
      &lt;/child&gt;
      &lt;action-widgets&gt;
        &lt;action-widget response="0"&gt;button1&lt;/action-widget&gt;
        &lt;action-widget response="0"&gt;button2&lt;/action-widget&gt;
      &lt;/action-widgets&gt;
    &lt;/object&gt;
  &lt;/interface&gt;
  </code></pre>
  
  <p>test.py </p>
  
  <pre><code>#!/usr/bin/python
  
  import pygtk
  import gtk
  import gtk.glade
  import os
  
  
  class app:
      def __init__( self ):
  
              self.builder = gtk.Builder()
          self.builder.add_from_file("test.glade")
  
          self.window = self.builder.get_object('window1')
              self.alert = self.builder.get_object('dialog1')
  
              dic = { 
                "on_hello_clicked" : self.checkon,
              }
  
              self.builder.connect_signals( dic )
          self.window.show_all()
  
      def checkon(self, widget):
                  check_process = os.popen('pgrep firefox').read()
                  if check_process:
                      os.popen('pkill -9 firefox')
                  else:
                      self.alert.show()
  
  
  addgui = app()
  gtk.main()
  </code></pre>