深入探索 GTK4 与 Gnuplot:在树莓派上的实践指南
1. GTK4 程序开发
在树莓派上开发 GTK4 程序,我们可以使用文本编辑器编写代码,以下是一个简单的 GTK4 程序示例:
/* Place the Quit button in the grid cell (0, 1), and make it
* span 2 columns.
*/
gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1);
gtk_widget_show (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example",
G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
编译该程序可以使用以下命令:
gcc $(pkg-config --cflags gtk4) -o example-2 example-2.c $(pkg-c