[Ironpython-users] Help with NumPy
Hi, Where is the best place to get help on NumPy for IronPython? (I cross-posted also to the SciPy4dotNet list but that list looks kind of dead...) My current question is, how can I create a numpy.ndarray from a System.Array? I hoped it would just work to pass the Array to ndarray() or asarray() but neither of these seem to work. I am working with large, 3-dimensional arrays so it would be nice to avoid copying the array in a loop. More generally, what is the current status of NumPy and SciPy for IronPython? The projects don't show any signs of life - no checkins since the original release, no activity on the mailing list, very difficult to even find a place to ask questions. It kind of looks like Microsoft commissioned the original work but after the release there is no funding and no community. I'm most interested in finding sources for help and documentation. Thanks for any help, tips or pointers, Kent ___ Ironpython-users mailing list [email protected] http://mail.python.org/mailman/listinfo/ironpython-users
[Ironpython-users] FW: IronPython WPF application
I am simply trying to get the handle to a WPF window, but it doesn't seem to be working. I am as new to WPF as I am to IronPython so please forgive me :) >From what I have read I believe the handle is not getting set in __init__ >because it is only available at run_time(?) Therefore, have to add Loaded="Window_Loaded" in MyWindow.xaml so that handle is guaranteed to be set after window is loaded(?) However, this requires a routed event handler which, I know nothing about but I do know the line: ((MyWindow)(target)).Loaded += System.Windows.RoutedEventHandler(this.Window_Loaded); Works in C#, not sure what the equivalent line would be in IronPython? Please help, I simply want to run MyWindow and get a handle to it! Here is a snippet of my code: class MyWindow(Window): def __init__(self): wpf.LoadComponent(self, 'WpfApp_Test.xaml') self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not getting set dir(self.hWnd) def Window_Loaded(self): self.hWnd = WindowInteropHelper(self).Handle #never gets called if __name__ == '__main__': Application().Run(MyWindow()) #((MyWindow)(target)).Loaded += System.Windows.RoutedEventHandler(MyWindow().Window_Loaded) Actual, WPF IronPython app (VS2010) is contained in .zip folder attached (just need to rename .zzz to .zip and decompress) Cheers, Jackie WpfApp_Test.zzz Description: WpfApp_Test.zzz ___ Ironpython-users mailing list [email protected] http://mail.python.org/mailman/listinfo/ironpython-users
Re: [Ironpython-users] FW: IronPython WPF application
Hmm. Perhaps you should have a look at the WPF example here: http://www.ironpython.info/index.php/WPF_Example. That one doesn't try to load its UI out of an XML file. There appear to be some tricks applicable to XAML with WPF, relating to where you can load the XML from: http://stackoverflow.com/questions/710329/load-external-xaml-file-using-loadcomponent It seems that the XAML may be subject to an interesting variant of their site-origin policy :( Cheers, Michael On Tue, Dec 11, 2012 at 4:03 AM, Jackie Sproat wrote: > ** ** > > I am simply trying to get the handle to a WPF window, but it doesn’t seem > to be working. > > I am as new to WPF as I am to IronPython so please forgive me J > > > From what I have read I believe the handle is not getting set in __init__ > because it is only available at run_time(?) > > Therefore, have to add Loaded=”Window_Loaded” in MyWindow.xaml so that > handle is guaranteed to be set after window is loaded(?) > > However, this requires a routed event handler which, I know nothing about > but I do know the line: > > ** ** > > ((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(this.Window_Loaded); > > Works in C#, not sure what the equivalent line would be in IronPython? > > ** ** > > Please help, I simply want to run MyWindow and get a handle to it! > > ** ** > > ** ** > > Here is a snippet of my code: > > class MyWindow(Window): > > def __init__(self): > > wpf.LoadComponent(self, 'WpfApp_Test.xaml') > > self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not > getting set > > dir(self.hWnd) > > def Window_Loaded(self): > > self.hWnd = WindowInteropHelper(self).Handle #never gets called*** > * > > > > if __name__ == '__main__': > >Application().Run(MyWindow()) > > #((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(MyWindow().Window_Loaded) > > ** ** > > Actual, WPF IronPython app (VS2010) is contained in .zip folder attached > (just need to rename .zzz to .zip and decompress) > > ** ** > > Cheers, > > Jackie > > ___ > Ironpython-users mailing list > [email protected] > http://mail.python.org/mailman/listinfo/ironpython-users > > ___ Ironpython-users mailing list [email protected] http://mail.python.org/mailman/listinfo/ironpython-users
Re: [Ironpython-users] FW: IronPython WPF application
Hi, The Window_Loaded event handler is not being run since it is missing two parameters. This is causing wpf.LoadComponent to not wire it up for you. If you change the code to the following then the event handler will run and you will be able to access the window handle. def Window_Loaded(self, sender, e): self.hWnd = WindowInteropHelper(self).Handle Alternatively to wire up the event handler in code you can use: def __init__(self): wpf.LoadComponent(self, 'WpfApp_Test.xaml') self.Loaded += self.Window_Loaded Regards, Matt On 10 December 2012 17:03, Jackie Sproat wrote: > > > I am simply trying to get the handle to a WPF window, but it doesn’t seem to > be working. > > I am as new to WPF as I am to IronPython so please forgive me J > > > From what I have read I believe the handle is not getting set in __init__ > because it is only available at run_time(?) > > Therefore, have to add Loaded=”Window_Loaded” in MyWindow.xaml so that > handle is guaranteed to be set after window is loaded(?) > > However, this requires a routed event handler which, I know nothing about > but I do know the line: > > > > ((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(this.Window_Loaded); > > Works in C#, not sure what the equivalent line would be in IronPython? > > > > Please help, I simply want to run MyWindow and get a handle to it! > > > > > > Here is a snippet of my code: > > class MyWindow(Window): > > def __init__(self): > > wpf.LoadComponent(self, 'WpfApp_Test.xaml') > > self.hWnd = WindowInteropHelper(self).Handle #self.hWnd is not > getting set > > dir(self.hWnd) > > def Window_Loaded(self): > > self.hWnd = WindowInteropHelper(self).Handle #never gets called > > > > if __name__ == '__main__': > >Application().Run(MyWindow()) > > #((MyWindow)(target)).Loaded += > System.Windows.RoutedEventHandler(MyWindow().Window_Loaded) > > > > Actual, WPF IronPython app (VS2010) is contained in .zip folder attached > (just need to rename .zzz to .zip and decompress) > > > > Cheers, > > Jackie > > > ___ > Ironpython-users mailing list > [email protected] > http://mail.python.org/mailman/listinfo/ironpython-users > ___ Ironpython-users mailing list [email protected] http://mail.python.org/mailman/listinfo/ironpython-users
