Discussion:
[Python.NET] DataGridView Issue
Manfred Schulte-Oversohl
2012-05-31 17:18:39 UTC
Permalink
With Ironpython 2.7 the following code works. Not so with python for .Net
where only a blank Form is displayed.
Used python for .Net is compiled from trunk of May 26, 2012 python 2.6 and
clr4.

Any help is appreciated.

Cheers
Manfred
#-------------------------

import clr

clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

import System.Windows.Forms as WinForms
import System
from System.Drawing import Size, Point

SAMPLE_DATA = [
('Joe', 23),
('Bob', 8),
('Thomas', 32),
('Patrick', 41),
('Kathy', 19),
('Sue', 77),
]

class Person(System.Object):
def __init__(self, name, age):
self.Name = name
self.Age = age

people = []
for name, age in SAMPLE_DATA:
people.append(Person(name, age))

f=WinForms.Form()
f.Text = u"DataGridView From Python"
h = WinForms.SystemInformation.CaptionHeight
fdgv=WinForms.DataGridView()
fdgv.AutoSize = True
fdgv.Dock = WinForms.DockStyle.Fill
fdgv.DataSource = people
fdgv.Refresh()
f.Controls.Add(fdgv)
WinForms.Application.Run(f)
Tribble, Brett
2012-06-28 17:33:41 UTC
Permalink
Can Person derive from System.Collections.Arraylist instead of a System.Object?

http://msdn.microsoft.com/en-us/library/system.collections.arraylist(v=vs.71).aspx



From: pythondotnet-bounces+btribble=ea.com-+ZN9ApsXKcEdnm+***@public.gmane.org [mailto:pythondotnet-bounces+btribble=ea.com-+ZN9ApsXKcEdnm+***@public.gmane.org] On Behalf Of Manfred Schulte-Oversohl
Sent: Thursday, May 31, 2012 10:19 AM
To: pythondotnet-+ZN9ApsXKcEdnm+***@public.gmane.org
Subject: [Python.NET] DataGridView Issue

With Ironpython 2.7 the following code works. Not so with python for .Net where only a blank Form is displayed.
Used python for .Net is compiled from trunk of May 26, 2012 python 2.6 and clr4.

Any help is appreciated.

Cheers
Manfred
#-------------------------

import clr

clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

import System.Windows.Forms as WinForms
import System
from System.Drawing import Size, Point

SAMPLE_DATA = [
('Joe', 23),
('Bob', 8),
('Thomas', 32),
('Patrick', 41),
('Kathy', 19),
('Sue', 77),
]

class Person(System.Object):
def __init__(self, name, age):
self.Name = name
self.Age = age

people = []
for name, age in SAMPLE_DATA:
people.append(Person(name, age))

f=WinForms.Form()
f.Text = u"DataGridView From Python"
h = WinForms.SystemInformation.CaptionHeight
fdgv=WinForms.DataGridView()
fdgv.AutoSize = True
fdgv.Dock = WinForms.DockStyle.Fill
fdgv.DataSource = people
fdgv.Refresh()
f.Controls.Add(fdgv)
WinForms.Application.Run(f)
Manfred Schulte-Oversohl
2012-06-29 09:06:37 UTC
Permalink
It did not work.

In the meantime I took XPTable instead of DataGridView which did want I
want.

http://www.codeproject.com/Articles/11596/XPTable-NET-ListView-meets-Java-s-JTable?msg=2332119#xx2332119xx


Manfred
Post by Tribble, Brett
Can Person derive from System.Collections.Arraylist instead of a
System.Object?****
** **
http://msdn.microsoft.com/en-us/library/system.collections.arraylist(v=vs.71).aspx
****
** **
** **
** **
Schulte-Oversohl
*Sent:* Thursday, May 31, 2012 10:19 AM
*Subject:* [Python.NET] DataGridView Issue****
** **
With Ironpython 2.7 the following code works. Not so with python for .Net
where only a blank Form is displayed.
Used python for .Net is compiled from trunk of May 26, 2012 python 2.6 and clr4.
Any help is appreciated.
Cheers
Manfred
#-------------------------
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
import System.Windows.Forms as WinForms
import System
from System.Drawing import Size, Point
SAMPLE_DATA = [
('Joe', 23),
('Bob', 8),
('Thomas', 32),
('Patrick', 41),
('Kathy', 19),
('Sue', 77),
]
self.Name = name
self.Age = age
people = []
people.append(Person(name, age))
f=WinForms.Form()
f.Text = u"DataGridView From Python"
h = WinForms.SystemInformation.CaptionHeight
fdgv=WinForms.DataGridView()
fdgv.AutoSize = True
fdgv.Dock = WinForms.DockStyle.Fill
fdgv.DataSource = people
fdgv.Refresh()
f.Controls.Add(fdgv)
WinForms.Application.Run(f)****
Loading...