GTK中的启动画面
我是GTK的新手,我正在用它在C语言中创建UI.我创建了一个初始屏幕,并且可以在指定的几秒钟后使用功能g_timeout_add(100, function_to_call, NULL);
将其关闭.初始屏幕效果很好.但是问题是当进一步扩展程序时(即)关闭启动屏幕后,我希望另一个窗口自动显示,但不会发生.两个窗户一起打开.这是我的程序.
I'm new to GTK and i'm using it to create UI in C. I've created a splash screen and i'm able to close it after specified seconds using the function g_timeout_add(100, function_to_call, NULL);
. The Splash screen works great. but the problem is when in extend my program further (i.e) After closing the splash screen I want another window to be displayed automatically, it doesn't happen so. Both the windows open together. Here is my program.
gboolean function_to_call(gpointer data){
gtk_quit_main();
return(FALSE);
}
int main (int argc, char *argv[]){
GtkWidget *window, *image, *another_window;
gtk_init(&argc, &argv);
.
.
.
.
.
.
.
g_timeout_add (100, function_to_call, NULL);
gtk_main ();
/*if my program is till this, splash screen closes after 1 sec . But when i try
*to define another window from here onwards and call gtk_widget_show() and gtk_main()
*again for another_ window, window and another_window both open together and window
*doesn't close after 1 sec. */
}
任何帮助都是可贵的.
谢谢你.
Any kind of help is appreciatable.
Thank you.
您的function_to_call不会在此处关闭启动窗口,它会结束gtk_main事件循环.您无需结束事件循环.
Your function_to_call doesn't close your splash window here, it ends the gtk_main event loop. You don't need to end the event loop.
相反,您要在function_to_call
中隐藏(或销毁)初始窗口并显示下一个窗口(gtk_widget_hide()
,gtk_widget_show()
).
What you want to do instead, in your function_to_call
, is hide (or destroy) your splash window and show your next window (gtk_widget_hide()
,gtk_widget_show()
).