简体   繁体   English

Python Gtk3,MessageDialog,隐藏对话框后的默认焦点响应?

[英]Python Gtk3, MessageDialog, default focused response after hiding dialog?

after destroying dialog we can create new one with default focused response using set_default_response method. 销毁对话框后,我们可以使用set_default_response方法创建具有默认焦点响应的新对话框。 but when we hide dialog instead of destroying, this method does not work. 但是当我们隐藏对话框而不是销毁对话框时,此方法不起作用。 how can I do this ? 我怎样才能做到这一点 ?

example

#dialog variable is a GtkMessage dialog.
dialog.run()
dialog.hide()
dialog.run() # default focus doesn't work when we run dialog again after hiding.

Thanks. 谢谢。

Note: sorry for asking questions frequently 注意:很抱歉经常问问题

This does not happen because the dialog widget will keep its state. 这不会发生,因为对话框窗口小部件将保持其状态。 This is the expected behavior. 这是预期的行为。 If you destroy and create a new one, it will be initialized. 如果销毁并创建一个新的,它将被初始化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM