Hi!

I'm trying to create a windows installer for a small app that uses
python + pygtk + gtk with the 'py2exe + innosetup' method. For that I
first have to get the app working with hand-installed python + pygtk +
gtk, of course (so that I can run py2exe and copy the necessary dll-s).

I installed python-2.4.3.msi from python.org,
pygtk-2.8.6-1.win32-py2.4.exe from
http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ and
gtk-win32-2.8.14-rc1 from http://gladewin32.sourceforge.net/
(I'm using windows 2000 as an OS)

Small 'Helloworld' apps work, but I get a segfault when calling
gtk.glade.set_custom_handler(). Attached is a small example which
segfaults.

I also tried to use the gtk installer from
http://gimp-win.sourceforge.net/stable.html (version
gtk+-2.8.9-setup-1.zip) instead of the ones from gladewin32, but in
that case even 'helloworld' apps crash with a 'libglib.....dll not
found' error message. (where .... is the version, etc.) such a dll
file is installed by the gimp-win installer to a directory that is on
the PATH, so I think that the pygtk bindings should be able to find
it. Any ideas what else should be set?

I guess the segfaults when calling gtk.glade.set_custom_handler() are
due to some internal mismatch (perhaps because python and gtk where
compiled with different compilers?). But the above should work (as
that is the "recommended way" as far as I could see). And I bet that
_some_ people have installed python + pygtk + gtk with basically the
same method. Which exact installers and versions have you used?

(I would like to avoid having to compile anything, if at all
possible. Using older versions would be acceptable, however.)

Thanks in advance,
Abel Daniel

--
#!/usr/bin/env python
# originally from a tutorial which was:
#Licence: GPLv2.0
#Copyright: Dave Aitel

import sys

import pygtk
#tell pyGTK, if possible, that we want GTKv2
pygtk.require("2.0")

import gtk
import gtk.glade
import gobject

def insert_row(model,parent,firstcolumn,secondcolumn):
    myiter=model.insert_after(parent,None)
    model.set_value(myiter,0,firstcolumn)
    model.set_value(myiter,1,secondcolumn)
    return myiter

class appgui:
  def __init__(self):
    """
    In this init we are going to display the main serverinfo window
    """
    gladefile="demogtk.glade"
    windowname="serverinfo"
    print "this is where the segfault happens:"
    gtk.glade.set_custom_handler(self.custom_maker)
    print "we wont reach this"
    self.wTree=gtk.glade.XML (gladefile,windowname)


    dic = { "on_button1_clicked" : self.button1_clicked,
            "on_serverinfo_destroy" : (gtk.main_quit)}
    self.wTree.signal_autoconnect (dic)


  #####CALLLBACKS
  def button1_clicked(self,widget):
      print "button clicked"
  def custom_maker(self, *args, **kw_args):
      print args, kw_args
      l = gtk.Label('Foo')
      l.show()
      return l

app=appgui()
gtk.main()
--
where demogtk.glade is:
--
<?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="serverinfo">
  <property name="visible">True</property>
  <property name="title" translatable="yes">Server Info</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <signal name="destroy" handler="on_serverinfo_destroy" 
last_modification_time="Wed, 15 Jan 2003 16:24:14 GMT"/>

  <child>
    <widget class="GtkVBox" id="vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child>
        <widget class="GtkButton" id="button1">
          <property name="visible">True</property>
          <property name="can_focus">True</property>
          <property name="label" translatable="yes">GO!</property>
          <property name="use_underline">True</property>
          <property name="relief">GTK_RELIEF_NORMAL</property>
          <signal name="clicked" handler="on_button1_clicked" 
last_modification_time="Wed, 15 Jan 2003 15:10:01 GMT"/>
        </widget>
        <packing>
          <property name="padding">0</property>
          <property name="expand">False</property>
          <property name="fill">False</property>
        </packing>
      </child>

      <child>
        <widget class="Custom" id="custom">
          <property name="visible">True</property>
          <property name="creation_function">make_custom</property>
          <property name="int1">0</property>
          <property name="int2">0</property>
          <property name="last_modification_time">Mon, 01 May 2006 10:08:53 
GMT</property>
        </widget>
        <packing>
          <property name="padding">0</property>
          <property name="expand">False</property>
          <property name="fill">False</property>
        </packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>
--
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to