WPF & Python.NET or IronPython (and Maya)

Anyone on this forum using WPF with any of the .NET pythons? I have a question or two I want to ask.

We’re doing a bit, but not actually spawing WPF from python .NET. We’re spawning WPF and using Python .NET to communicate with the form, but that’s about it.

So when you’re spawning your WPF, are you using the XAML file or the compiled BAML file? The reason I ask is I’m trying to make sure the image files can be loaded by the "Source = ". If it’s not compiled, it’s looking for the path in the Python.exe directory and not where the script is located (and where the images are). If the XAML is compiled, there is no problem with this - however Python.NET can not access BAML files and you have no choice but to load the XAML directly.

Well like i said, we’re not spawning WPF from Python .NET, we’re just launching an executable and using Python .NET to drive WCF communication between our WPF app and Maya.

I guess you didn’t understand… thanks anyway.

seriously dude? just trying to help. . .

Yeah not really, do you mean inspecting/interacting with the object post spawning? You must be interacting with your WPF objects differently because we don’t ever touch the XAML at all outside of the c# code. . .what exactly are you trying to do?

[QUOTE=djTomServo;2073]seriously dude? just trying to help. . .

Yeah not really, do you mean inspecting/interacting with the object post spawning? You must be interacting with your WPF objects differently because we don’t ever touch the XAML at all outside of the c# code. . .what exactly are you trying to do?[/QUOTE]

No, I really did mean thanks.

I was able to find a solution - in an unpublished book. In the upcoming IronPython in Action, Ch 11 gives a solution in how to load resources when calling XAML directly from Python. I too do not want to modify the XAML once it’s authored - the issue is where the XAML considers the directory where all the graphics resources are located. Since the script is launched by Python, it bases all the paths from the directory where Python.exe is and not where the XAML code is.