Here is an error i get when selecting a row in a clist widget
whose 'select row' event is connected to a simple callback, using
python libglade :
-----------------------------------------------------------------------
Traceback (innermost last):
File "/usr/lib/python1.5/site-packages/libglade.py", line 28, in
__call__
   ret = apply(self.func, a)
   TypeError: too many arguments; expected 2, got 4
------------------------------------------------------------------------

I couldn't find any good reason, and everything works fine with buttons
and menu 'clicked' and windows 'destroy' events...

Anyone having an idea?
As it is my first attempts using pygtk + libglade (as well as Python in
fact), i'm a bit lost for now,
can it be a python libglade bug? Or a dirty beginner nonsense?

I've attached offending .glade and .py files...

Software versions :
* Pygtk 0.6.2
* libglade 0.6
* libxml 1.7.2
* glade 0.5.3

My python version is the bare one which come with debian 2.0, is it
1.5.0 ?

Xavier
#!/usr/bin/env python

from gtk import *
from libglade import *

def close(widget, _event=None):
    print "Closing..."
    mainquit()

def on_clist1_select_row(widget, _event=None):
    print"Selected !"

def on_button1_clicked(widget, _event=None):
    i_data = ["1st column","2nd column","3rd column"]
    print "Inserting ..."
    interface.get_widget("clist1").append(i_data)    

##########################################################
# MAIN 
##########################################################
interface = GladeXML('project2.glade')
# connect signals, etc...

interface.signal_autoconnect({'on_window1_destroy':close})
interface.signal_autoconnect({'on_clist1_select_row':on_clist1_select_row})
interface.signal_autoconnect({'on_button1_clicked':on_button1_clicked})

## #interface.signal_autoconnect({'':})

mainloop()
<?xml version="1.0"?>
<GTK-Interface>

<project>
  <name>Project2</name>
  <program_name>project2</program_name>
  <directory></directory>
  <source_directory>src</source_directory>
  <pixmaps_directory>pixmaps</pixmaps_directory>
  <language>C</language>
  <gnome_support>False</gnome_support>
  <gettext_support>False</gettext_support>
  <use_widget_names>False</use_widget_names>
  <output_main_file>True</output_main_file>
  <output_support_files>True</output_support_files>
  <output_build_files>True</output_build_files>
  <backup_source_files>True</backup_source_files>
  <main_source_file>interface.c</main_source_file>
  <main_header_file>interface.h</main_header_file>
  <handler_source_file>callbacks.c</handler_source_file>
  <handler_header_file>callbacks.h</handler_header_file>
  <support_source_file>support.c</support_source_file>
  <support_header_file>support.h</support_header_file>
  <translatable_strings_file></translatable_strings_file>
</project>

<widget>
  <class>GtkWindow</class>
  <name>window1</name>
  <width>300</width>
  <height>200</height>
  <signal>
    <name>destroy</name>
    <handler>on_window1_destroy</handler>
    <last_modification_time>Tue, 19 Oct 1999 11:06:50 GMT</last_modification_time>
  </signal>
  <title>window1</title>
  <type>GTK_WINDOW_TOPLEVEL</type>
  <position>GTK_WIN_POS_NONE</position>
  <modal>False</modal>
  <allow_shrink>False</allow_shrink>
  <allow_grow>True</allow_grow>
  <auto_shrink>False</auto_shrink>

  <widget>
    <class>GtkVBox</class>
    <name>vbox1</name>
    <homogeneous>False</homogeneous>
    <spacing>0</spacing>

    <widget>
      <class>GtkScrolledWindow</class>
      <name>scrolledwindow1</name>
      <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
      <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
      <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
      <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
      <child>
        <padding>0</padding>
        <expand>True</expand>
        <fill>True</fill>
      </child>

      <widget>
        <class>GtkCList</class>
        <name>clist1</name>
        <can_focus>True</can_focus>
        <signal>
          <name>select_row</name>
          <handler>on_clist1_select_row</handler>
          <last_modification_time>Tue, 19 Oct 1999 11:15:35 
GMT</last_modification_time>
        </signal>
        <columns>3</columns>
        <column_widths>80,80,80</column_widths>
        <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
        <show_titles>True</show_titles>
        <shadow_type>GTK_SHADOW_IN</shadow_type>

        <widget>
          <class>GtkLabel</class>
          <child_name>CList:title</child_name>
          <name>label3</name>
          <label>label3</label>
          <justify>GTK_JUSTIFY_CENTER</justify>
          <wrap>False</wrap>
          <xalign>0.5</xalign>
          <yalign>0.5</yalign>
          <xpad>0</xpad>
          <ypad>0</ypad>
        </widget>

        <widget>
          <class>GtkLabel</class>
          <child_name>CList:title</child_name>
          <name>label4</name>
          <label>label4</label>
          <justify>GTK_JUSTIFY_CENTER</justify>
          <wrap>False</wrap>
          <xalign>0.5</xalign>
          <yalign>0.5</yalign>
          <xpad>0</xpad>
          <ypad>0</ypad>
        </widget>

        <widget>
          <class>GtkLabel</class>
          <child_name>CList:title</child_name>
          <name>label5</name>
          <label>label5</label>
          <justify>GTK_JUSTIFY_CENTER</justify>
          <wrap>False</wrap>
          <xalign>0.5</xalign>
          <yalign>0.5</yalign>
          <xpad>0</xpad>
          <ypad>0</ypad>
        </widget>
      </widget>
    </widget>

    <widget>
      <class>GtkButton</class>
      <name>button1</name>
      <can_focus>True</can_focus>
      <signal>
        <name>clicked</name>
        <handler>on_button1_clicked</handler>
        <last_modification_time>Tue, 19 Oct 1999 11:11:06 GMT</last_modification_time>
      </signal>
      <label>Insert datas in list</label>
      <child>
        <padding>0</padding>
        <expand>False</expand>
        <fill>False</fill>
      </child>
    </widget>
  </widget>
</widget>

</GTK-Interface>

Reply via email to