如何将 TextField 绑定到 IBOutlet()?
我试图弄清楚如何以编程方式更新 NSTextField 。
我已经弄清楚如何从 Python 获取文本字段的当前值:
myVar = objc.IBOutlet()
....
self.myVar.stringValue()
How do I set the value of myVar from the Python side and have the GUI update?我想要某种双向绑定(例如 Flex 中的 {myVAR})。
谢谢!
I'm trying to figure out how to update an NSTextField programatically.
I've figured out how to get the current value of the Text Field from Python:
myVar = objc.IBOutlet()
....
self.myVar.stringValue()
How do I set the value of myVar from the Python side and have the GUI update? I'd like some sort of two way binding (like {myVAR} in Flex).
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你为什么想要这么做?笔尖加载器将其设置为控件;如果你设置了变量,你就会失去控制。
要设置控件的值,请向其发送
setStringValue_
(或类似)消息。Why would you want to? The nib loader set it to a control; if you set the variable, you would lose the control.
To set the value of the control, send it a
setStringValue_
(or similar) message.