我在做简单的图形用户界面计算器。我有0-9之间的数字按钮。我把所有的数字和算术符号存储在一个名为caluclations的字符串中。我有一个函数,它正在执行以下操作:
newString = ""
newString += calculations
newString += (here is the button text(for example if button1 was clicked i will add to newString "1")
return newString
我想当我按下一个按钮时,调用函数并将newString返回到计算中字符串。有吗思想?你知道吗
要调用一个按钮上的函数,首先要创建这样的函数
然后,当你创建按钮时,你指定你希望它在按下时执行这个功能,就像这样
但是如果你想传递参数给它,在你的例子中,你可能会这样做
相关问题 更多 >
编程相关推荐