문제

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