Code: Select all
init python:
result = str()
def someFunction():
if user_action == "o":
result = "correct"
elif user_action == "x":
result = "wrong"
return result
screen someScreen:
textbutton _("button"):
action [someFunction(), Show("dashboard")]
I think the correct explanation of your error would be:
your action executes function someFunction(), the function returns "correct" or "wrong"
which results in:
Code: Select all
action ["correct", Show("dashboard")]
the things in the bracket are "callables"
"correct" is a string/word, unicode
something like Show() is a valid "callable"
something like a string "correct" is not a valid "callable" for action
hence your code results in
Code: Select all
action ["correct", Show("dashboard")]
and throws an error like
TypeError: 'unicode' object is not callable
which means: the string "correct" is not a valid attribute for "action"
when you remove return from your function, it doesn't return anything, so I think you end up with
hence, you get no errors