当前位置:网站首页>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!!!
边栏推荐
- 【Pei Shu Theorem】CF1055C Lucky Days
- EasyGBS connects to mysql database and prompts "can't connect to mysql server", how to solve it?
- conda创建虚拟环境方法和pqi使用国内镜像源安装第三方库的方法教程
- strongest brain (1)
- FPGA engineer interview questions collection 31~40
- 深度梳理:防止模型过拟合的方法汇总
- Interface documentation evolution illustration, some ancient interface documentation tools, you may not have used it
- Interface debugging also can play this?
- 请教一下各位大佬。CDC社区中FlinkCDC2.2.0版本有说明支持的sqlserver版本 ,请
- How to use Apifox's Smart Mock function?
猜你喜欢

一文带你搞懂OAuth2.0

Rpc接口压测

canvas canvas drawing clock

虚拟土地价格暴跌85% 房地产泡沫破裂?依托炒作的暴富游戏需谨慎参与

Qiskit官方文档选译之量子傅里叶变换(Quantum Fourier Transform, QFT)

MySQL simple tutorial

Jenkins 如何玩转接口自动化测试?

手把手带你写嵌入式物联网的第一个项目

Why are negative numbers in binary represented in two's complement form - binary addition and subtraction

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
随机推荐
成为黑客不得不学的语言,看完觉得你们还可吗?
FPGA engineer interview questions collection 21~30
论文精度 —— 2016 CVPR 《Context Encoders: Feature Learning by Inpainting》
ThreadPoolExecutor线程池原理
SQL Server查询优化
Guys, the test in the idea uses FlinkCDC SQL to read Mysql data and write it into Kafka. The code creates
看了几十篇轻量化目标检测论文扫盲做的摘抄笔记
I have a dream for Career .
线性模型中的高级特征选择技术——基于R
Why are negative numbers in binary represented in two's complement form - binary addition and subtraction
反转链表中的第m至第n个节点---leetcode
一篇文章带你搞懂什么是幂等性问题?如何解决幂等性问题?
How does flinksql write that the value of redis has only the last field?
Touch chip used in smart touch remote control
SSM框架整合实例
基于BP神经网络的多因素房屋价格预测matlab仿真
如何用Apifox 的智能Mock功能?
SEO搜索引擎优化
Hezhou ESP32C3 +1.8"tft network clock under Arduino framework
The sword refers to Offer 033. Variation array