[IronPython] TreeStore ...

Phillip Neumann bob at sofsis.cl
Tue Oct 5 23:57:04 CEST 2004


Here is what im doing in C# that i wish to do with python:

C# file:

using System;
using Gtk;

public class TreeViewSample {
     public static void Main (string [] args)
          Application.Init ();
          Window win = new Window ("Demo");
          win.SetDefaultSize (400,250);

          TreeStore store = new TreeStore (typeof (string), typeof
          TreeIter iter = store.AppendValues ("Hello","all");

          TreeView tv = new TreeView ();		  
          tv.Model = store;
          tv.HeadersVisible = true;
          tv.AppendColumn ("Demo", new CellRendererText (), "text", 0);
          tv.AppendColumn ("Data", new CellRendererText (), "text", 1);

          win.Add (tv);
          win.ShowAll ();
          Application.Run ();


-------> Works perfectly

IronPython try:
import System
from Gtk import *

class TreeViewSample:
	def __init__(self):
		Application.Init ();
		win = Window("Demo");
		win.SetDefaultSize (400,250)

		store = TreeStore ( str, str)
		store.AppendValues ("Hello","all")

		#Ones the Store works, i hope TreeView works too...
		#tv = TreeView ()
		#tv.Model = store
		#tv.HeadersVisible = true
		#tv.AppendColumn ("Demo", CellRendererText (), "text", 0)
		#tv.AppendColumn ("Data", CellRendererText (), "text", 1)

		#win.Add (tv)
		win.ShowAll ()
		Application.Run ()


killfill at book ~/MONO> ironpython pythontry.py

Unhandled Exception: System.ArgumentException: parameters
in <0x00085> System.Reflection.MonoCMethod:Invoke
in <0x0001d> System.Reflection.MonoCMethod:Invoke
in <0x00044> System.Reflection.ConstructorInfo:Invoke (object[])
in <0x000f9> IronPython.Objects.ReflectedMethodBase:Call (object[])
in <0x00029> IronPython.Objects.ReflectedType:Call (object[])
in <0x00210> IronPython.Objects.Ops:Call (object,object,object)
in <0x000f9> __main__:__init__$f0 (object)
in <0x0006d> (wrapper delegate-invoke)
System.MulticastDelegate:invoke_object_object (object)
in <0x00026> IronPython.Objects.Function1:Call (object)
in <0x00053> IronPython.Objects.Function1:Call (object[])
in <0x000b8> IronPython.Objects.Ops:Call (object,object[])
in <0x00021> IronPython.Objects.Method:Call (object[])
in <0x000b8> IronPython.Objects.Ops:Call (object,object[])
in <0x00046> IronPython.Objects.Ops:TryToInvoke
in <0x0004c> IronPython.Objects.OldClass:Call (object[])
in <0x001b3> IronPython.Objects.Ops:Call (object)
in <0x000c2> __main__:init ()
in <0x002a0> IronPythonConsole.IronPython:DoFile (string[])
in <0x0005d> IronPythonConsole.IronPython:Main (string[])

ive try to use instead of str System.String and GLib.Type.String but the
result is the same.

Anyone ever made use a TreeView in Ironpython?....

thank you very much

Phillip Neumann <bob at sofsis.cl>

More information about the Ironpython-users mailing list