我正在使用TraitsUI开发应用程序.
我需要弹出一个窗口来请求一些值.
会有类似ProcessValues按钮和SaveValues按钮的东西.
应该没有OK按钮
在下面的示例代码,点击按钮使得在处理程序的信息,可以打印,但我不知道怎样做才能做出比点击[X]在框架窗口关闭自行关闭等.
重载close()似乎不起作用,因为它被称为AFTER OK被点击.也许有一种生成close_window事件的方法,或者它可能是其他东西.
有人可以帮忙吗?
from enthought.traits.api import HasTraits, Instance, Str, Int, List, Any, DelegatesTo
from enthought.traits.ui.api import Handler, View, Item, Action
class MyPanelHandler(Handler):
def _process_values(self, info):
#>>>reach process_values() through info and call
print 'values processed OK'
#>>> what goes here so that the window is closed?
def _save_values(self, info):
#>>>reach save_values() through info and call
print 'values saved OK'
#>>> what goes here so that the window is closed?
class MyPanel(HasTraits):
model = Any …Run Code Online (Sandbox Code Playgroud)