3

我制作了一个GtkDialog对象,但我想禁用或处理转义按下事件,我该怎么做?

4

2 回答 2

2

连接到delete-event,并在回调中检查事件是否被 ESC 按键触发。返回 TRUE 停止事件传播(这是您要忽略 ESC 键按下的内容),返回 FALSE 将传播事件并关闭对话框。

于 2012-10-24T11:51:17.897 回答
0

如果您:

在此处输入图像描述

将响应信号绑定到事件:

    def on_dialogBigLabel_response(self, widget, response_id):
        print('on_dialogBigLabel_response Widget: %s | response_id: %s' % (widget, response_id))

        if response_id == Gtk.ResponseType.OK:
            print('OK')
            self.dialogBigLabel.hide()
        else:
            print('Response: %i' % response_id)

现在逃逸响应是-4,这里我们没有隐藏或破坏对话框。

于 2020-09-02T11:34:08.913 回答