当前位置:网站首页>GtkD开发之路
GtkD开发之路
2022-08-10 05:29:00 【溴锑锑跃迁】
这些文章仅是记录我用GtkD做GUI的学习,当然,来访的各位可以借鉴看看(如果不嫌弃的话)。
1.配置开发环境
GtkD是基于D语言的GUI开发库,在我看来比较易用。
第一步,先配置好D语言的开发环境:
1.访问官网:https://dlang.org.下载并安装最新版的D语言安装程序。
/
安装完之后,在辗转去GtkD官网:https://gtkd.org/download.html。
下载Gtkd的压缩包和GTK+ Runtime安装包。

先安装Gtk+ Runtime。待安装之后,打开压缩包。
由于D语言2.077有一些小猫饼,所以,国外某大神改了一下Build.d的源代码。地址如下: https://github.com/gtkd-developers/GtkD/commit/9ac582dc0a7fa1ce958a15048b6bcc3ddbcad858 将代码直接替换Build.d中的代码就OK了。
我这里是Windows 7 32bit,如果也是用Windows的朋友可以参考官方的安装方法:https://github.com/gtkd-developers/GtkD/wiki/Installing-on-Windows。
在一切都配置好后,让我们来写段代码。
import gtk.MainWindow;
import gtk.Label;
import gtk.Main;
void main(string[] args)
{
Main.init(args);
MainWindow win = new MainWindow("Hello World");
win.setDefaultSize(200, 100);
win.add(new Label("Hello World"));
win.showAll();
Main.run();
}将其保存在hello.d中,敲开命令行,输入:dmd hello.d -L+gtkd.lib
编译成功后,运行hello.exe

我们第一个用GtkD做的GUI程序已经成功运行了!
总体来说,如果去看看官方给的Win32开发会觉得还是老一套:注册、回调、消息循环……。希望有一种语言可以把这种GUI开发方式嵌入库中。寄希冀于Swift!!!
边栏推荐
- FPGA工程师面试试题集锦11~20
- Depth of carding: prevent model fitting method
- 从GET切换为POST提交数据的方法
- mysql常用命令有什么
- I have a dream for Career .
- Transforming into a product, is it reliable to take the NPDP test?
- FPGA engineer interview questions collection 41~50
- SEO搜索引擎优化
- Mysql CDC (2.1.1) inital snapshot database set up five concurrent degree, se
- Nexus_仓库类型
猜你喜欢
随机推荐
Concurrency tool class - introduction and use of CountDownLatch, CyclicBarrier, Semaphore, Exchanger
FPGA engineer interview questions collection 41~50
剑指Offer 033.变位数组
Stacks and Queues | Valid parentheses, delete all adjacent elements in a string, reverse Polish expression evaluation, maximum sliding window, top K high frequency elements | leecode brush questions
mysql常用命令有什么
转型做产品,考NPDP靠谱吗?
【LeetCode】41. The first missing positive number
SEO搜索引擎优化
Kubernetes:(十七)Helm概述、安装及配置
并发工具类——CountDownLatch、CyclicBarrier、Semaphore、Exchanger的介绍与使用
基于Qiskit——《量子计算编程实战》读书笔记(七)
Mysql CDC (2.1.1) inital snapshot database set up five concurrent degree, se
Attention candidates for the soft exam! The detailed registration process for the second half of 2022 is coming!
大咖说·对话生态|当Confluent遇见云:实时流动的数据更有价值
OAuth2 usage scenarios, common misunderstandings, use cases
大佬们,mysql cdc(2.2.1跟之前的版本)从savepoint起有时出现这种情况,有没有什
FPGA engineer interview questions collection 31~40
An article to master the entire JVM, JVM ultra-detailed analysis!!!
聊聊 API 管理-开源版 到 SaaS 版
基于Qiskit——《量子计算编程实战》读书笔记(六)









