Thanks for the reply. This is what I have:

def inputBox_KeyDown(s, e):
    root.message.Text = ''
    key = e.Key.value__
    if key == 3:
        result = eval(root.inputBox.Text)
        root.message.Text = str(result)

eval() seems to work sometimes. For example if the text in the textbox is
1+1 . But if the text for example is a=1 i get an error "Unexpected token
'=' " (This is in Ironpython studio). I guess it is because a=1 is not an
expression. What should I use then? What if I don't know what the user will
type in? 

Thanks again!
-- 
View this message in context: 
http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21031241.html
Sent from the IronPython mailing list archive at Nabble.com.

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

Reply via email to