[Python.NET] function assignment

Fulop David fulopd at 5ncomp.hu
Thu Jul 24 13:09:01 CEST 2008


Hello

I am new in python, so I don't know, what has to be worked, and what is under 
development.

But I have a problem:
If use python for .net 2.0 alpha 2 and matplotlib
If I run python2.4-UCS2\python.exe and I type the following code, it is 
working. (this is not the problem :) )

import pylab as p
def onclick(event):  
  print 'clicked'
fig=p.figure()
ax = fig.add_subplot(111)
ax.plot(t1, s1, linewidth=1.0)

fig.canvas.mpl_connect('button_press_event',cl)
p.show()

But if I want to run the following script with ironpython 2B3 it did not work.

from embedding import Import
pyl=Import('pylab')
fig = pyl.plt.figure()

def onclick(event):  
  print 'clicked'

cid = fig.canvas.mpl_connect('button_press_event', onclick)
pyl.show()

I used python2.4-UCS2 dll and a necessary embedding.py.

The problem with the onclick object.
Why does it work only in the first case?

The main reason for i am interested in is that I want to host ironpython in 
c# and I want use matplotlib in ironpython.

The bests
David Fulop



More information about the PythonDotNet mailing list