[IronPython] using XAML in IronPython
fuzzyman at voidspace.org.uk
Sat Jul 10 00:19:27 CEST 2010
On 09/07/2010 23:14, Andrew Evans wrote:
> Hello I am learning IronPython having come from a CPython background,
> I started learning C# to add more to my knowledge base for IronPython.
> I have a few questions using XAML:
> First if I build something using the xaml designer in IronPython Studio
Don't do that, really. IronPython Studio uses IronPython 1 which is
years out of date. Plus it is very unstable. Use IronPython Tools for
Visual Studio 2010 instead:
I don't think the xaml designer works particularly well with IronPython
Tools, but you can use the xaml designer in Expression or Visual Studio
> and give it a name x:name="somename" and want to reference it in a
> function def doSomething(s, e): how do I reference the item with the
> x:name value do I just type somename = changePropertyofControl? and
> how do I call the function?
Controls with an x:Name can be accessed as named attributes on parent
def doSomething(s, e):
button = root.hello # also equals "s" as it happens
root = XamlReader.Load(FileStream('Hello_World.xaml', FileMode.Open))
> Title="Hello World" Height="300" Width="300">
> <Button x:Name="hello">Click Me</Button>
> Python Code is where I am confused
> import clr
> from System.Windows.Markup import XamlReader
> from System.Windows import Application
> from System.IO import FileStream, FileMode
> app = Application()
> def doSomething(sender,event):
> hello.Content = "Try again"
> app.Run(XamlReader.Load(FileStream('Hello_World.xaml', FileMode.Open)))
> This I am sure is really simple... Coming from a Tk background its
> confusing for me.
> Anyway ty
> Users mailing list
> Users at lists.ironpython.com
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users