[Linux可视化编程系列二] 掀起 Gtkmm + libglademm 的盖头来

【c++实现单机/多人联机 TankTrouble(坦克动荡) (一) —— 单机模式 使用c++17 + gtkmm实现单机/online 坦克动荡游戏 阅读详情
Gtkmm 类库的良好设计,使得学习Gtkmm程序的开发变得很容易。对于尝试过MFC的程序员,必将惊讶于Gtkmm的直观明了。 Glade 是可视化设计的不二之选。遗憾的是,有关 Gtkmm + libglademm 编程的文档实在太少,只在《Programming with gtkmm》第 23 章有提及(注:你也可以在DEVHELP的“gtkmm 2.4 library reference manual”中点击BOOK看到这本书)。我们的目标就是用 Gtkmm + libglademm 实现Linux的可视化编程,看看这个Flash视频的演示,你就能领略到可视化编程的魅力。 这里,我们将从一个最简单、最基本的Gtkmm程序开始;然后稍作拓展,并结合libglademm得到我们自己的Helloworld程序。虽然Anjuta自动生成的那些代码也做了同样的事,但你后面会发现,我们的设计更优雅,更符合面向对象的思想。 你需要掌握C++的基本知识,这里将不作这方面的详细说明,以利于文档的简洁。特别是要求能够理解命名空间、继承和模板类等。 最简单的Gtkmm程序 在《用 Anjuta 轻松搭建 Gtkmm+libglademm 开发环境》一文的演示过程中,我们建立了一个Gtkmm工程。现在,请暂时忘掉Anjuta自动生成的那些代码,让我们从一个最简单的Gtkmm程序开始吧!它的有效源码只有六行,我们采用在中间穿插注释的方式,对它进行分析理解。 (tipfoo 原创作品,转载请注明出处: http://blog.csdn.net/tipfoo/ ,商业用途请联系作者<tipfoo@gmail#com>,未经授权,不得使用。)
代码:
/*Gtkmm程序的基本头文件,下面用到的两个类就由它定义*/ #include <gtkmm.h> int main (int argc, char *argv[]) {    /*    每一个Gtkmm应用程序都必须有这样一个类的实例,并且
Linux下的Gtkmm编程实验 本文将介绍一些在Linux下使用Gtkmm进行编程的实验,并提供相应的源代码。在开始Gtkmm编程之前,我们需要确保在Linux系统中安装了Gtkmm库。通过这些实验,你可以开始在Linux下使用Gtkmm进行GUI编程。Gtkmm提供了丰富的功能和灵活的布局管理器,使得开发用户友好的应用程序变得更加简单和方便。编译和运行上述代码,将创建一个带有一个按钮的窗口。编译和运行上述代码,将创建一个带有两个按钮的窗口,这些按钮将按照网格布局排列。编译和运行上述代码,将创建一个大小为200x200的空白窗口。 阅读详情

相关推荐

gtkmm-plplot:利用PLplot的功能为Gtkmm提供科学的绘图库

Gtkmm-PL图 Gtkmm-PLplot是一个简单的绘图库,它将PLplot的功能带到了Gtkmm。 它是依靠Gtk :: DrawingArea小部件来完成的,该小部件的绘图信号使用PLplot的extcairo绘图设备在屏幕上生成出版物质量的绘图... 当前,该库正在大量开发中,但对于简单的二维图形来说应该已经有用了。 该API绝对不应该被认为是稳定的,并且会在没有警告的情况下进行更改... Gtkmm-PLplot已根据LGPLv3许可。 特征 使用两个std :: vector,std :: valarray和boost :: multi_array对象创建图。 拖动选择框进行放大。 支持二维图,极坐标图,带有或不带有阴影区域的轮廓图,三维线图 在单个画布上支持多个独立控制的图。 广泛使用libsigc ++信号 高度可扩展 要求 Gtkmm3 PLplot(至少为

别再死记硬背了!用LabVIEW串口通信的3个真实项目案例,手把手教你从调试到部署

本文通过3个真实项目案例,详细讲解LabVIEW串口通信从调试到部署的全过程。涵盖Arduino温湿度监控、西门子PLC Modbus通信以及高可靠性通信框架设计,提供实用技巧和常见问题解决方案,帮助工程师快速掌握LabVIEW串口通信的实战应用。

weixin_30485379的博客 535

深度学习暑期科研项目(两个月发EI论文)

对本科生而言,越早接触系统的科研训练开始上手科研项目,就越能在未来的升学求职中占据很大的优势。暑假是提升个人简历、丰富科研经历的最佳时期!哈尔滨工业大学博士师兄也会在8月1日开始带大家上手科研项目,并撰写发表EI会议论文。

Magnolia_He的博客 1452

YOLOv8实战:5分钟搞定Windows环境下的目标检测模型部署(附常见报错解决方案)

本文详细介绍了在Windows环境下快速部署YOLOv8目标检测模型的实战指南,包括环境配置、模型加载、快速验证及常见报错解决方案。通过5分钟快速入门教程,帮助开发者高效实现计算机视觉应用,特别适合需要快速上手的AI开发者。

weixin_30566063的博客 564

保姆级教程:用Vue3+Element Plus快速搭建Flowable流程定义管理后台界面

本文提供了一份详细的Vue3+Element Plus教程,指导开发者快速搭建Flowable流程定义管理后台界面。从项目初始化、核心页面设计到响应式数据处理,全面覆盖前端开发关键步骤,帮助提升企业级应用开发效率。

weixin_42662293的博客 488

看完让你的RSA提升一个台阶 [GKCTF 2021]RRRRsa

我是,今天我给大家分享一个关于RSA的题目,带大家领略的魅力。今天开始前,我们先学习一下。

m0_62102520的博客 861

学Simulink——基于Simulink的数字孪生:实车数据驱动电机参数辨识

本文介绍了基于Simulink的数字孪生技术在电机参数辨识中的应用。针对理想模型与实际工况的差异问题,提出通过实车数据驱动的高保真模型构建方案。文章详细阐述了数字孪生核心架构、关键参数辨识方法(包括递推最小二乘法、高频信号注入等)以及完整的Simulink建模流程,从数据准备、参考模型搭建到参数辨识算法实现。同时提供了工程实践要点和常见问题解决方案,展示了该技术在特斯拉、比亚迪等实际案例中的应用价值。通过数据驱动方式实现模型参数实时校准,可显著提升电机控制精度和系统可靠性。

amy_mhd的博客 42

1-Spring Security OAuth2专栏介绍

我自己 我是码农小胖哥,一名后端软件工程师,有多年的后端开发经验,同时也是一名热衷于技术分享、拥抱开源的技术博主。我的技术栈主要是Java、Python、Kotlin,欢迎各位同行进行交流和分享。 个人技术公众号:码农小胖哥 个人博客:https://felord.cn Gitee: https://gitee.com/felord 你可以通过以上方式和我交流、解决学习中的疑难杂症。 2021年开源Spring Security 干货系列教程,2022年又开源Spring Security进阶版,帮

码农小胖哥 7944

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

上一篇: [Linux可视化编程系列一] 用 Anjuta 轻松搭建 Gtkmm+libglademm 集成开发环境(IDE)
下一篇: [Linux可视化编程系列三] 体验Glade的可视化界面设计
kerwinpc
博客等级 码龄22年 10粉丝 47原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值