空地 aboutDialog 未关闭
我有一个在林间空地制作的 AboutDialog
框,但“关闭”按钮不起作用。 我不知道如何将此按钮连接到单独的函数,因为它位于名为 dialog-action_area
的小部件中。
另一个问题是,如果我使用窗口管理器创建的关闭按钮,我无法再次打开它,因为它已被破坏。
我怎样才能改变它,让它隐藏起来?
I have an AboutDialog
box made in glade, but the Close button doesn't work. I don't know how to connect this button to a separate function, since it sits in a widget called dialog-action_area
.
Another problem is if I use the close button created by the window manager, I can't open it again because it has been destroyed.
How can I change this so it just hides?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与任何其他对话框窗口一样,它们要求您
第一个将阻塞主循环,并在对话框收到响应后立即返回,这可能是单击操作区域中的任何按钮或按 Esc,或调用对话框的响应方法或“销毁”窗口,最后一个并不意味着窗口将被销毁,这意味着 run() 方法将退出并返回响应。 像这样:
如果您使用调试器,您会注意到主循环一直保留在那里,直到您单击按钮或尝试关闭对话框。 收到回复后,您就可以根据需要使用它。
第二个允许您以非阻塞方式使用对话框,然后您必须将对话框连接到“响应”信号。
现在,您注意到必须销毁对话框
As any other Dialog window, they require you to
The first will block the main loop and will return as soon as the dialog receives a response, this may be, click on any button in the action area or press Esc, or call the dialog's response method or "destroy" the window, the last don't mean that the window wil be destroyed, this means that the run() method will exit and return a response. like this:
If you use a debugger, you will notice that the main loop stays there until you click on a button or try to close the dialog. Once you have received yout response, then you can useit as you want.
The second allow you to use the dialog in a non-blocking stuff, then you have to connect your dialog to the "response" signal.
Now, you notice that you have to destroy your dialog
当您收到删除或取消信号时,您需要调用小部件的 hide() 方法:
您可以找到响应类型常量 GTK 文档
You need to call the widget's hide() method when you receive delete or cancel signals:
You can find the Response Type constants in the GTK documentation