[IronPython] Experience installing IP with the new WPF CTP

Martin Maly Martin.Maly at microsoft.com
Wed Dec 28 01:31:31 CET 2005


Hi Iain,

What an interesting coincidence. I just finished a sweep through the tutorial, updating it with the new Avalon samples that work with the December CTP. The WinFX has changed substantially between the September and December CTPs. You pretty much found the right solutions to all roadblocks that you encountered. As for the animation, I wasn't able to find what the new way of doing things was so it is the only thing that I didn't get working. However, the tutorial will be updated (as well as the Embed directory sample) in the next release.

Thanks!
Martin

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Iain Mackay
Sent: Tuesday, December 27, 2005 4:25 PM
To: users at lists.ironpython.com
Subject: [IronPython] Experience installing IP with the new WPF CTP

I ran into several problems running the first Avalon example from the tutorial, using IP 0.9.6

I should mention that at this time I was running .net Framework 2.0 and the Dec 2005 CTP preview of WPF x64 versions without the Framework SDK; installing the SDK subsequently did not change the behaviour.

I noticed three problems:

- I couldn't set the Text attribute on a Window object
- I couldn't set the TextContent attribute on a TextBlock object
- the class RepeatBehaviour seems not to be imported.

Another strange aspect is that I get this far when I enter the script interactively to the console, but when I put the script in a file and execute it from the command line I get the exception:
"System.InvalidOperationException: The calling thread must be STA, as many UI components require this." on calling the Show method of the Window object. I think I might need to rebuild the console to sort this out - C# and .net threading models are rather a steep learning curve for this evening, so I've stuck to interactive experiments for now.

Here's my console experience following the tutorial:

G:\downloads\ironpython\IronPython-0.9.6\IronPython-0.9.6\Tutorial>ironpytho
nconsole
IronPython 0.9.6 on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> from avalon import *
>>> w=Window ()
>>> w.Show ()
>>> w.Text="Avalon app"
Traceback (most recent call last):
   at <shell>
TypeError: can't set arbitrary attributes on built-in type System.Windows.Window

This is quite right, because Windows do not have a Text attribute. However, if you set Title, all is well.

>>> w.Content = TextBlock ()
>>> w.Content.TextContent = "Hello IronPython!"
Traceback (most recent call last):
   at <shell>
TypeError: can't set arbitrary attributes on built-in type System.Windows.Contro ls.TextBlock

Similarly, w.Content.Text = "Hello IronPython", works just fine. You can discover the attributes of w of course just by:

for (key, value) in w.__dict__.items (): print key, value

(Iron)Python is so cool like that.

>>> w.Content.FontSize = 50
>>> a=DoubleAnimation(0.0,Duration(TimeSpan.FromSeconds(3)))
>>> a.RepeatBehaviour = RepeatBehaviour.Forever
Traceback (most recent call last):
   at <shell>
NameError: name 'RepeatBehaviour' is not defined
>>> ^Z

I didn't persist beyond here just yet. I suppose there have been some substantial changes in object properties during the evolution of WPF as seen in this latest preview, not yet reflected in the tutorial source - a life on the bleeding edge thing.

>>> import sys
>>> sys.path
['G:\\downloads\\ironpython\\IronPython-0.9.6\\IronPython-0.9.6\\Tutorial',
'G:\\downloads\\ironpython\\IronPython-0.9.6\\IronPython-0.9.6\\bin\\Lib']
>>>

Anyway, a whole lot of wonderful things are working straight out of the box, including the XAML calculator. This is going to be a lot of fun. Thanks to everyone for getting things this far. Am I doing something silly to get the threading problem?

Iain MacKay


_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list