C GTK +定期事件以更新UI [英] C GTK+ periodic event to update the UI

查看:82
本文介绍了C GTK +定期事件以更新UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在定期事件中更新GTK +接口.例如,假设我要更新一个包含每200毫秒时间的文本字段.通常这是怎么做的?

How can I update a GTK+ interface on a periodic event. For example, let's say I wanted to update a text field containing the time every 200 milliseconds. How is this typically done?

更新:

另一个问题(如何在gtk中执行定期作业应用程序?)提到g_timeout_add.这是执行此操作的最佳方法吗?据说在那个线程中效率可能不高?

Another question (How one executes a periodic job in gtk application?) mentiones g_timeout_add. Is this the best way to go about doing this? It is said in that thread that it may not be efficient?

推荐答案

本教程有一个例子. (搜索标题为计时器示例"的部分.)

This tutorial has an example. (Search for the section titled "A timer example".)

简短的答案是使用

The short answer is "use g_timeout_add".

这篇关于C GTK +定期事件以更新UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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