Gtk2的一些东西
来源:互联网 发布:网络与信息安全学报 编辑:程序博客网 时间:2024/05/16 19:50
今天到处查了一下有关main_loop(gtk2里就直接是Gtk2->main了)和main_iteration的区别
If you are in the main loop and have a function which needs some time to
execute, then it is a good idea to let the GUI update itself from time
to time. E.g. when you calculate something, and the calculation needs 20
seconds to finish, the app is blocked - you can't click anywhere to stop
it or so. If you stop your calculation every second and let the gui
handle the events, it's a lot better, because the app responds to the
user. The events_pending/main_iteration is for this.
原文:http://aspn.activestate.com/ASPN/Mail/Message/php-gtk-general/2084492
大概意思是当要执行需要很长时间的代码的时候,调用main就会让app挂起,而main_iteration就是解决这个问题的。
这个正好在程序的主loop(不是ui的lopp)可以实现
但是我发现在调用main_iteration的时候再调用main_quit的话会报错:
Gtk-CRITICAL **: file gtkmain.c: line 1231 (gtk_main_quit): assertion `main_loops != NULL' failed at Gui.pm line 34.
看到另外一个代码是怎样写的:
If you are in the main loop and have a function which needs some time to
execute, then it is a good idea to let the GUI update itself from time
to time. E.g. when you calculate something, and the calculation needs 20
seconds to finish, the app is blocked - you can't click anywhere to stop
it or so. If you stop your calculation every second and let the gui
handle the events, it's a lot better, because the app responds to the
user. The events_pending/main_iteration is for this.
原文:http://aspn.activestate.com/ASPN/Mail/Message/php-gtk-general/2084492
大概意思是当要执行需要很长时间的代码的时候,调用main就会让app挂起,而main_iteration就是解决这个问题的。
这个正好在程序的主loop(不是ui的lopp)可以实现
但是我发现在调用main_iteration的时候再调用main_quit的话会报错:
Gtk-CRITICAL **: file gtkmain.c: line 1231 (gtk_main_quit): assertion `main_loops != NULL' failed at Gui.pm line 34.
看到另外一个代码是怎样写的:
$window = Gtk2::Dialog->new("wget: $desc", undef, []);还没看明白……
$window->signal_connect( 'response' => &exit_gracefully );
$window->signal_connect( 'close' => &exit_gracefully );
$PID = open(IN, "$command $uri 2>&1 |") or die "Unable to open pipe: $!n";
# -- Exit on button press -------------------------------------
#
sub exit_gracefully {
print "Living to 0. Killing $PID...n";
kill TERM => $PID;
kill KILL => $PID if kill 0 => $PID;
wait;
print "...done.n";
$LIVING = 0;
Gtk2->main_quit;
exit;
}
- Gtk2的一些东西
- gtk2,glade的帮助文件
- caoz的一些东西
- javascript的一些东西
- 整理的一些东西
- 一些肤浅的东西
- 一些琐碎的东西
- 一些琐碎的东西
- 一些基本的东西
- NFS的一些东西
- 一些基础的东西
- 一些基础的东西
- 中国的一些东西
- 反射的一些东西
- 学到的一些东西
- flex的一些东西!
- 一些杂乱的东西
- oracle 的一些东西
- ASP.NET中的FILE对象总结
- asp.net中利用CDONTS发送邮件的列子
- 梦里花落知多少
- C'EST UN TEST de français
- SQL 2000中的触发器使用
- Gtk2的一些东西
- “抗病”菜:洋葱炒肉 蒜香肉丁
- 西式洋葱炒鸡蛋
- 洋葱炒肉
- 洋葱排骨
- 一天一位家乡口音很重的县长到村里作报告:
- 第六章 初次接触:DirectDraw
- (日) 暮苍山兰舟 (小),
- 《一千年以后》最后一百元