如何知道何时完全显示Gtk窗口? [英] How to know when a Gtk Window is fully shown?
问题描述
我想知道完全显示 Gtk.Window
时发出的信号,而完全显示则表示窗口本身及其小部件也显示.
I'd like to know which signal is emitted when a Gtk.Window
is fully shown, with fully shown I mean the window itself is shown and its widgets too.
我尝试了几种信号:
- 显示
- 实现
- visibility-notify-event
- set_focus
但它们都无法正常工作.
but none of them works properly.
我在网上找到的唯一有趣的答案是此.
The only interesting answer I found on the web is this.
推荐答案
在 GtkWidget :: draw 信号(在GTK + 2中以前称为 expose
).
Connect a callback after the GtkWidget::draw signal (previously called expose
in GTK+2).
附录
还有其他东西在起作用: double缓冲,客户端窗口和(为什么不是吗?)小部件可以在空闲回调中延迟其绘制的事实.
There is other stuff that comes into play: double buffering, client-side windows and (why not?) the fact that a widget can defer its drawing in an idle callback.
If you want to know when your main window appears the first time, it is far easier (and saner) add a g_idle_add
after your show_all
call.
这篇关于如何知道何时完全显示Gtk窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!