GtkDialog映射没有临时父项 [英] GtkDialog mapped without a transient parent

查看:4529
本文介绍了GtkDialog映射没有临时父项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内置于Glade(3.18)的GUI,它由Python 3程序(使用PyGObject)调用。在运行程序(Fedora 21)时,我收到很多警告:

  Gtk-Message:GtkDialog映射时没有瞬态家长。这是不鼓励的。 

如何解决此警告?我尝试在Glade的所有对话框窗口中填写 Transient for:main_window 字段,但警告依然出现。

你通过给GtkDialog一个父对象来解决这个警告。相关函数是 gtk_window_set_transient_for()(它将此窗口设置为始终位于另一个窗口的顶部,或 transient),另一个可选 gtk_window_set_modal()使其成为模态对话框。这最终是各种GtkDialog构造函数的作用。


I have a GUI built in Glade (3.18) which is called by a Python 3 program (using PyGObject). I get a lot of warnings when running the program (Fedora 21) that say:

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

How can I fix this warning? I tried filling in the field Transient for: main_window in Glade for all the dialog windows, but the warnings still appear.

解决方案

You fix this warning by giving the GtkDialog a parent to be modal to. The relevant functions are gtk_window_set_transient_for() (which sets this window to always be on top of, or transient for, another one) and optionally gtk_window_set_modal() to make it a modal dialog. This is ultimately what the various GtkDialog constructors do.

这篇关于GtkDialog映射没有临时父项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆