[Python.NET] Delegates and Dictionaries

Brian Lloyd brian.d.lloyd at gmail.com
Tue Apr 4 22:00:02 CEST 2006


Sorry, I'm way behind on mail ;)

If I'm reading this right, the issue is that a Python dictionary does
not automatically convert to any particular .NET type (where your
tuples and ints were likely auto
converted to arrays and int32s). Generally speaking, you can't really
meaningfully
pass an arbitrary Python object to .NET code unless it is (a) directly
convertible to
a primitive .NET type or (b) an instance of a .NET type.

In this case, you might want to create a Hashtable or something and pass that,
as that would be visible on the .NET side.

-Brian

On 3/21/06, Mark Anderson <mark at walkereconomics.com> wrote:
> Hi all,
>
> I'm using .NET to implement a UI for some python code, and am updating
> various UI components using a .NET function.
> The .NET based UI calls the python based back end with an argument set
> which includes a delegate to the .NET UI update function.
> The python code then periodically invokes the delegate (passing it "a
> bunch of updated information") which is then used to update the UI.
>
> The problem is this:
> when "a bunch of updated information" is an integer, or a tuple,
> everything functions correctly.
> when "a bunch of updated information" is a python Dictionary, I receive
> the dreaded
>
> "TypeError: no method matches given arguments"
> message.
>
>
> I've tried explicitly typing the delegate argument as a PyDict, to no avail.
>
> Any suggestions?
>
> Thanks,
>
> Mark Anderson
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
>


More information about the PythonDotNet mailing list