Discussion:
[Python.NET] I need to use C# list as an object for one of my controls
Jojo Maquiling
2013-05-24 01:40:59 UTC
Permalink
Here is the issue that i need to address:

*
*
*# My declaration is just fine here *
def __init__(self,fname,lname):
self.Firstname = fname
self.Lastname = lname

*# adding a value also goes fine. *
j = person('jojo','maquiling')
j
<__main__.person object at 0x029E7C88>
j.Firstname
'jojo'
j.Lastname
'maquiling'

*#but then when i use listing and print it, here comes the problem*
*
*
listing = List[person]()
listing
<System.Collections.Generic.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]] object at 0x029E7C60>
listing.Add(person('pepe','smith'))
print l.Firstname

*Traceback (most recent call last):*
* File "<pyshell#78>", line 2, in <module>*
* print l.Firstname*
*AttributeError: 'Object' object has no attribute 'Firstname'*
*
*

Can any body help me on how to do this properly?
Thanks and best regards,

Jojo Maquiling
*
*
*
*
b***@public.gmane.org
2013-05-24 04:00:17 UTC
Permalink
What exactly are you trying to do? It looks like you are trying to create a class in python that inherits from .net's System.Object, rather than python's object. But then you treat it as a dynamic object, which it really isn't. And then you try and treat it as a statically typed object, which it doesn't seem t be either really, now that you've treated it as dynamic in python. What is the intent? Do you mean to create a dynamic object that both .net and python treat as a dynamically typed object?
Post by Jojo Maquiling
# My declaration is just fine here
self.Firstname = fname
self.Lastname = lname
# adding a value also goes fine.
j = person('jojo','maquiling')
j
<__main__.person object at 0x029E7C88>
j.Firstname
'jojo'
j.Lastname
'maquiling'
#but then when i use listing and print it, here comes the problem
listing = List[person]()
listing
<System.Collections.Generic.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] object at 0x029E7C60>
listing.Add(person('pepe','smith'))
print l.Firstname
File "<pyshell#78>", line 2, in <module>
print l.Firstname
AttributeError: 'Object' object has no attribute 'Firstname'
Can any body help me on how to do this properly?
Thanks and best regards,
Jojo Maquiling
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
Jojo Maquiling
2013-05-24 04:07:45 UTC
Permalink
Actually i'm just trying to use a .net System.Object List with this one -
http://objectlistview.sourceforge.net/cs/index.html. I like the way the
grid is displayed on that objectlistview so i'm trying to experiment and
dispay, but what i get is just an empty row.

Here is the snippet of my code.

def LoadRecord(self,sender,e):
listing = List[person]()
listing.Add(person('jojo','maquiling'))
listing.Add(person('gary','granada'))
self._objectListView1.SetObjects(listing)


A datagrid is good,I have used it, but then i just want to figure out also
if its possible for me to use this ObjectListView control on my application.

Thanks and best regards.

Jojo Maquiling
Post by b***@public.gmane.org
What exactly are you trying to do? It looks like you are trying to create
a class in python that inherits from .net's System.Object, rather than
python's object. But then you treat it as a dynamic object, which it
really isn't. And then you try and treat it as a statically typed object,
which it doesn't seem t be either really, now that you've treated it as
dynamic in python. What is the intent? Do you mean to create a dynamic
object that both .net and python treat as a dynamically typed object?
*
*
*# My declaration is just fine here *
self.Firstname = fname
self.Lastname = lname
*# adding a value also goes fine. *
j = person('jojo','maquiling')
j
<__main__.person object at 0x029E7C88>
j.Firstname
'jojo'
j.Lastname
'maquiling'
*#but then when i use listing and print it, here comes the problem*
*
*
listing = List[person]()
listing
<System.Collections.Generic.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]] object at 0x029E7C60>
listing.Add(person('pepe','smith'))
print l.Firstname
*Traceback (most recent call last):*
* File "<pyshell#78>", line 2, in <module>*
* print l.Firstname*
*AttributeError: 'Object' object has no attribute 'Firstname'*
*
*
Can any body help me on how to do this properly?
Thanks and best regards,
Jojo Maquiling
*
*
*
*
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
Jojo Maquiling
2013-05-25 01:18:16 UTC
Permalink
Ok Thanks Brad for the reply.

I'm just confused really on that static and dynamic thing that i have
experimented on it via console. I have figure it out now on how to use that
objectlistview. I've just created a datatable and fill data on it and use
the DataListView which is part of the ObjectListView library.

Python dot net is really a great software.


On Fri, May 24, 2013 at 12:07 PM, Jojo Maquiling
Post by Jojo Maquiling
Actually i'm just trying to use a .net System.Object List with this one -
http://objectlistview.sourceforge.net/cs/index.html. I like the way the
grid is displayed on that objectlistview so i'm trying to experiment and
dispay, but what i get is just an empty row.
Here is the snippet of my code.
listing = List[person]()
listing.Add(person('jojo','maquiling'))
listing.Add(person('gary','granada'))
self._objectListView1.SetObjects(listing)
A datagrid is good,I have used it, but then i just want to figure out also
if its possible for me to use this ObjectListView control on my application.
Thanks and best regards.
Jojo Maquiling
Post by b***@public.gmane.org
What exactly are you trying to do? It looks like you are trying to
create a class in python that inherits from .net's System.Object, rather
than python's object. But then you treat it as a dynamic object, which it
really isn't. And then you try and treat it as a statically typed object,
which it doesn't seem t be either really, now that you've treated it as
dynamic in python. What is the intent? Do you mean to create a dynamic
object that both .net and python treat as a dynamically typed object?
*
*
*# My declaration is just fine here *
self.Firstname = fname
self.Lastname = lname
*# adding a value also goes fine. *
j = person('jojo','maquiling')
j
<__main__.person object at 0x029E7C88>
j.Firstname
'jojo'
j.Lastname
'maquiling'
*#but then when i use listing and print it, here comes the problem*
*
*
listing = List[person]()
listing
<System.Collections.Generic.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]] object at 0x029E7C60>
listing.Add(person('pepe','smith'))
print l.Firstname
*Traceback (most recent call last):*
* File "<pyshell#78>", line 2, in <module>*
* print l.Firstname*
*AttributeError: 'Object' object has no attribute 'Firstname'*
*
*
Can any body help me on how to do this properly?
Thanks and best regards,
Jojo Maquiling
*
*
*
*
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
Loading...