質問

I'm running into problems when I try to use the Vector class in IronPython. I think I may be missing a simple step.

I'm using IronPython version 2.7.3 with Python Tools for Visual Studio. My code looks like this:

import clr
clr.AddReference("System.Windows")
import System.Windows

x = System.Windows.Vector(4, 5)

When I run this I get an exception:

MissingMemberException was unhandled by user code:  attribute 'Vector' of 'namespace#' object is read-only

Any ideas of what I am missing? It's been a while since I last used IronPython, so I'm hoping is a really silly mistake.

役に立ちましたか?

解決

heh, I figured it out.

I needed to include the following line:

clr.AddReference("WindowsBase")

Now it's functioning as expected :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top