当前位置:网站首页>GTK实现旋转加载动画
GTK实现旋转加载动画
2022-08-03 15:36:00 【百口可乐__】
gtk_spinner的使用
#include <gtk/gtk.h>
GtkWidget *window = NULL;
GtkWidget *spinner = NULL;
static void
on_play_clicked (GtkButton *button, gpointer user_data)
{
gtk_spinner_start (GTK_SPINNER (spinner));
}
static void
on_stop_clicked (GtkButton *button, gpointer user_data)
{
gtk_spinner_stop (GTK_SPINNER (spinner));
}
int main() {
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *button;
gtk_init(NULL, NULL);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 200, 300);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
spinner = gtk_spinner_new ();
gtk_container_add (GTK_CONTAINER (vbox), spinner);
hbox = gtk_hbox_new (FALSE, 5);
button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY);
g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK (on_play_clicked), spinner);
gtk_container_add (GTK_CONTAINER (hbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_STOP);
g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK (on_stop_clicked), spinner);
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show_all(window);
g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL);
gtk_main();
return 0;
}
结果
边栏推荐
猜你喜欢
[Code Hoof Set Novice Village 600 Questions] Define a function as a macro
Basic knowledge points in js - events
简介undo log、truncate、以及undo log如何帮你回滚事物?
Essentially a database data recovery 】 【 database cannot read data recovery case
How Navicat connects to MySQL on a remote server
Ark server opening tutorial win
AWS China SDN Connector
新一代网状网协议T-Mesh无线通信技术优势介绍
【数据库数据恢复】SqlServer数据库无法读取的数据恢复案例
js数组方法总结
随机推荐
5v充8.4v1A电流充电管理ic
php类的析构函数:__destruct
DC-DC 2C(40W/30W) JD6606SX2退功率应用
新一代网状网协议T-Mesh无线通信技术优势介绍
2021年12月电子学会图形化三级编程题解析含答案:分身术
devops-3:Jenkins增加静态节点
Three key expectations for the crypto market in August Price moves north?Still expected to be in turmoil
5 v 8.4 v1A charging current charging management IC
问题10:注册页面的易用性测试?
2021年12月电子学会图形化三级编程题解析含答案:跳高比赛
【码蹄集新手村600题】将一个函数定义宏
Deep Learning - Install CUDA and CUDNN to implement GPU operation of tensorflow
PWA 应用 Service Worker 缓存的一些可选策略和使用场景
2021年12月电子学会图形化四级编程题解析含答案:质数判断器
问题6:下拉框测试点
教你如何获取微信公众号历史文章链接
PHP高级面试题 - 第二天
Optimal Power Flow (OPF) for High Voltage Direct Current (HVDC) (Matlab code implementation)
开源一夏 | 阿里云物联网平台之极速体验
接口测试主要测试什么?