当前位置:网站首页>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!!!
边栏推荐
- Interface debugging also can play this?
- Why are negative numbers in binary represented in two's complement form - binary addition and subtraction
- 常用工具系列 - 常用正则表达式
- aliases node analysis
- SQLSERVER 2008 parses data in Json format
- 树莓派入门(4)LED闪烁&呼吸灯
- 论文精度 —— 2017 ACM《Globally and Locally Consistent Image Completion》
- conda创建虚拟环境方法和pqi使用国内镜像源安装第三方库的方法教程
- 【裴蜀定理】CF1055C Lucky Days
- oracle rac 11g安装执行root.sh时报错
猜你喜欢
pytest测试框架
An article to master the entire JVM, JVM ultra-detailed analysis!!!
基于Servlet的验证码登陆demo
Linear Algebra (4)
Become a language that hackers have to learn. Do you think it's okay after reading it?
如何模拟后台API调用场景,很细!
成为黑客不得不学的语言,看完觉得你们还可吗?
暑期学前作业
如何用Apifox 的智能Mock功能?
如何在报表控件FastReport.NET中连接XLSX 文件作为数据源?
随机推荐
剑指Offer 033.变位数组
一篇文章掌握整个JVM,JVM超详细解析!!!
pytorch learning
Consulting cdc 2.0 for mysql does not execute flush with read lock. How to ensure bin
FPGA工程师面试试题集锦11~20
When oracle cdc, set the parallelism to 2 and the number of slots to 1, and the final task has only one tm. Is it because oracle does not support concurrency
Matlab simulation of multi-factor house price prediction based on BP neural network
MySql's json_extract function processes json fields
Flutter development: error The following assertion was thrown resolving an image codec: Solution for Unable to...
scikit-learn机器学习 读书笔记(二)
awk of the Three Musketeers of Shell Programming
【LeetCode】41. The first missing positive number
一文带你搞懂OAuth2.0
基于Qiskit——《量子计算编程实战》读书笔记(七)
conda创建虚拟环境方法和pqi使用国内镜像源安装第三方库的方法教程
各位大佬,idea中测试使用FlinkCDC SQL 读取Mysql 数据写入Kafka中,代码中创
Get started with the OAuth protocol easily with a case
顺序表的删除,插入和查找操作
从GET切换为POST提交数据的方法
实战小技巧19:List转Map List的几种姿势