Hi,
So I was trying to call a wpf xaml from python script in FB,
But as I tried "import wpf",
an error is raised: "ImportError: No module named wpf"
(But modules such as System, clr import perfectly fine)
Is there anyway to make wpf module works with FB?
Hi,
Can you import the wpf module using the IronPython console?
Cheers,
Ben
Thanks for the quick reply.
Yes, I can import wpf using IronPython console.
I've tried setting Python Library Directory to:
- ...\IronPython2.7\
- ...\IronPython2.7\DLLs\
- ...\IronPython2.7\Lib\
with no luck.
Hi,
Can you post your import code? I can’t seem to find a module named wpf referenced anywhere, and in the examples I’m finding online (eg http://ericgazoni.wordpress.com/2010/05/03/ironpython-wpf/) people are adding their WPF as such:
[code]import clrclr.AddReferenceByPartialName(“PresentationCore”)clr.AddReferenceByPartialName(“PresentationFramework”)[/code]
That code works fine for me in FinalBuilder.
Cheers,
Ben
Edit: OMG, I think I messed up with the post format I'm editing it
Hi,
I'm sorry on my lack of information.
The code is as follows (this is actually auto generated by Visual Studio 2010 with IronPython installed) :
[code]
import wpfimport Systemfrom System.Windows import Application, Windowclass MyWindow(Window): def __init__(self): wpf.LoadComponent(self, 'WpfApplication1.xaml') def Button_Click(self, sender, e): passApplication().Run(MyWindow())
[/code]
In IronPython console, calling wpf returns that it is a built-in function :
[code]
>>> import wpf>>> wpf
[/code]
I'll try using clr and see what comes up.
In both IronPython 2.6 and 2.7 (alpha) I get ‘No module named wpf’, and when I create a new IP/WPF solution in VS2010 I get:
[code]import clrclr.AddReference(‘PresentationFramework’) [/code]
My guess (and I’ll try to confirm) is that the wpf module has been added to IP 2.7 fairly recently. FinalBuilder uses IP2.6, so that may explain the problem.
Cheers,
Ben
Hi,
The following link:
http://ironpython.codeplex.com/releases/view/54498
This version of IronPython Tools includes a number of bug fixes as improved WPF designer support. The designer fully supports XAML and WPF including data binding to Python classes dynamically.
So I guess yeah, the module might be just added recently.
It’ll be great if FinalBuilder can support this, though.
Meanwhile, I’ll try using the clr way.
Thanks for your time : )