You're probably missing a reference to System.Windows.Input, doing:
clr.AddReference('System.Windows.Input')
will probably make it work.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Hird
Sent: Friday, September 18, 2009 9:05 AM
To: [email protected]
Subject: [IronPython] Having Issues With KeyUp Event
I am new to IronPython and kinda new to Python but i decided to look
around and find some samples and decided to build something using WPF
inside IronPython. I am trying to add a KeyUp event to a TextBox and
when i enter the texttbox and press any key i get an error. Now in WPF
this code works just fine but i cannot get the if statement correct
for some reason. Any Ideas?
Thanks!
[CODE]
def address_keyup(sender, args):
if args.Key == System.Windows.Input.Key.Enter:
LoadWebsite(address.Text)
[ERROR]
Traceback (most recent call last):
File "IronPythonWPFWebBrowser.py", line 118, in IronPythonWPFWebBrowser.py
File "PresentationFramework", line unknown, in Run
File "PresentationFramework", line unknown, in RunInternal
File "PresentationFramework", line unknown, in RunDispatcher
File "WindowsBase", line unknown, in Run
File "WindowsBase", line unknown, in PushFrame
File "WindowsBase", line unknown, in PushFrameImpl
File "WindowsBase", line unknown, in RaiseThreadMessage
File "PresentationCore", line unknown, in OnPreprocessMessage
File "PresentationCore", line unknown, in OnPreprocessMessageThunk
File "WindowsBase", line unknown, in Invoke
File "WindowsBase", line unknown, in InvokeImpl
File "WindowsBase", line unknown, in WrappedInvoke
File "WindowsBase", line unknown, in TryCatchWhen
File "WindowsBase", line unknown, in InternalRealCall
File "PresentationCore", line unknown, in OnPreprocessMessage
File "PresentationCore", line unknown, in CriticalTranslateAccelerator
File "PresentationCore", line unknown, in ProcessKeyAction
File "PresentationCore", line unknown, in ReportInput
File "PresentationCore", line unknown, in ReportInput
File "PresentationCore", line unknown, in ProcessInput
File "PresentationCore", line unknown, in ProcessStagingArea
File "PresentationCore", line unknown, in RaiseEvent
File "PresentationCore", line unknown, in RaiseEventImpl
File "PresentationCore", line unknown, in InvokeHandlersImpl
File "PresentationCore", line unknown, in InvokeHandler
File "PresentationCore", line unknown, in InvokeHandler
File "PresentationCore", line unknown, in InvokeEventHandler
File "", line unknown, in System.Void(Object, KeyEventArgs)
File "IronPythonWPFWebBrowser.py", line 99, in address_keyup
AttributeError: 'namespace#' object has no attribute 'Key'
--
--Nick
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com