当前位置:网站首页>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!!!
边栏推荐
- OAuth2 usage scenarios, common misunderstandings, use cases
- scikit-learn机器学习 读书笔记(二)
- Interface documentation evolution illustration, some ancient interface documentation tools, you may not have used it
- Buu Web
- 大佬们,运行cdc后oracle归档日志20分钟增长3G是正常现象吗
- 大佬们,mysql cdc(2.2.1跟之前的版本)从savepoint起有时出现这种情况,有没有什
- Jenkins 如何玩转接口自动化测试?
- Joomla vulnerability reproduced
- 实战小技巧19:List转Map List的几种姿势
- 应用在智能触摸遥控器中的触摸芯片
猜你喜欢

最强大脑(1)

Rpc interface stress test

一文带你搞懂OAuth2.0

Joomla漏洞复现

An article will help you understand what is idempotency?How to solve the idempotency problem?

【静态代理】

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

深度梳理:防止模型过拟合的方法汇总

线性模型中的高级特征选择技术——基于R

基于Qiskit——《量子计算编程实战》读书笔记(七)
随机推荐
【Pei Shu Theorem】CF1055C Lucky Days
FPGA engineer interview questions collection 31~40
深度梳理:防止模型过拟合的方法汇总
FPGA工程师面试试题集锦41~50
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
Attention candidates for the soft exam! The detailed registration process for the second half of 2022 is coming!
flex related
【LeetCode】41、 缺失的第一个正数
如何模拟后台API调用场景,很细!
SQL database field to append to main table
从GET切换为POST提交数据的方法
FPGA engineer interview questions collection 11~20
基于Qiskit——《量子计算编程实战》读书笔记(六)
线性模型中的高级特征选择技术——基于R
大咖说·对话生态|当Confluent遇见云:实时流动的数据更有价值
Talk about API Management - Open Source Edition to SaaS Edition
Guys, is it normal that the oracle archive log grows by 3G in 20 minutes after running cdc?
Touch chip used in smart touch remote control
FPGA engineer interview questions collection 21~30
基于Qiskit——《量子计算编程实战》读书笔记(七)