gpt4 book ai didi

c - gtk+ v3 将控制权返回给 main 进行重绘

转载 作者:行者123 更新时间:2023-11-30 17:39:41 24 4
gpt4 key购买 nike

我在名为 check_pwd 的函数中有一段代码可以执行以下操作:

if(g_strcmp0(s1,s2) != 0){
gtk_label_set_text(GTK_LABEL(a), "error");
return -1;
}
else{
gtk_label_set_text(GTK_LABEL(a), "ok");
//other things
}

虽然由于程序将控制权返回到主函数而显示“错误”消息,但如何显示“确定”消息?

最佳答案

当然,只需运行主循环:

while(gtk_events_pending())
gtk_main_iteration();

See the GTK+ documentation ,其中推荐上述内容:

Checks if any events are pending.

This can be used to update the UI and invoke timeouts etc. while doing some time intensive computation.

关于c - gtk+ v3 将控制权返回给 main 进行重绘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21729613/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com