PyQt5 QMainWindow 特性详解

PyQt5 QMainWindow 特性详解

一、QMainWindow 概述

1.1 基本概念

QMainWindow 是 PyQt5 中主窗口类的核心,它提供了一个典型的应用程序主窗口框架。与基本的 QWidget 不同,QMainWindow 具有预定义的结构布局,专门为应用程序的主窗口设计。

主要特点:

  • 预定义了菜单栏、工具栏、状态栏、停靠窗口和中心部件的区域
  • 自动管理各组件的位置和布局
  • 支持窗口分割和停靠功能
  • 提供标准的应用程序窗口行为

1.2 窗口结构组成

┌─────────────────────────────────────────────────────────────┐
│  Menu Bar        (菜单栏 - 顶部固定位置)                    │
├─────────────────────────────────────────────────────────────┤
│  Tool Bar        (工具栏 - 可停靠在四边)                    │
├───────┬────────────────────────────────────────────┬────────┤
pyqt5(9)-MDI多窗体显示-QMainWindow-QDialog-mdiArea 点击上面的菜单或者工具条,在右下框中显示出被点击的窗口。 网上对mdiArea的说明大部分是doc版的,我这是QMainWindow-QDialog版本的。 其实无论哪种都是3步 #1.DOC def newDocSub(self): newDoc = QMdiSubWindow(self) #1.创建子窗口 newDoc.setWindowTitle('新文档 ' + str(self.newDocIndex)) self.... 阅读详情

相关推荐

Pyqt 写用户界面的测试小工具

目录目录 一. 简介 · 什么是pyqt? · 编写目的? · pyqt有哪些优势? 二. 环境搭建 三. pyqt5三个窗口基类 · QmainWindow · QDialog · QWidget 四. pyqt5常用控件 · 文本类控件 · 按钮类控件 · 选择列表类控件 · 容器类控件 · 日期时间类控件 五. GUI常用的两种布局方式 · 绝对位置布局 · 布局类简介 六. setStyleSheet用法 · 窗口基类全局定义 七. QFrame简介 八. 实战篇:写一个测试工具 版本变更信息:版本

weixin_42021543的博客 1499

PyQt5基本控件详解之QMainWindow Python

在上面的代码中,我们首先创建了一个QMenuBar对象menubar,并将其设置为主窗口的菜单栏。在上面的代码中,我们创建了一个名为MyMainWindow的自定义主窗口类,并在构造函数中调用了父类的构造函数。在initUI()方法中,我们设置了窗口的标题为"My Main Window",并使用setGeometry()方法设置了窗口的位置和大小。在上面的代码中,我们首先创建了一个QApplication对象,然后实例化了MyMainWindow类的对象window,并调用show()方法显示窗口。

TechNovaX的博客 383

PyQt5基本窗口控件QMainWindow的使用详解

QMainWindow是PyQt5中最常用的窗口控件之一,它提供了一个主窗口的框架,可以方便地创建具有有菜单栏、工具栏、状态栏和中央工作区等功能的应用程序窗口。在本篇文章中,我们将详细介绍如何使用QMainWindow,并有菜单栏、工具栏、状态栏和中央工作区等功能的应用程序窗口。在这个类中,我们可以添加菜单栏、工具栏和中央工作区等部有菜单栏、工具栏、状态栏和中央工作区等功能的应用程序窗口。接下来,我们创建一个继承自QMainWindow的自定义有菜单栏、工具栏、状态栏和中央工作区等功能的应用程序窗口。

CfProgram的博客 274

如何使用PyQt5创建一个简单的主窗口应用程序

本文介绍使用PyQt5创建主窗口应用程序的步骤,包括导入模块、创建对象、设置属性和事件处理。通过简单实例演示基本功能,帮助读者快速上手。

专注于深入研究多种编程语言,以实战为导向,逐步拓展开发技能,提升工程化编码和思维能力,展现无敌技术实力。 775

避开这些坑!RK3588安卓系统内置输入法的正确姿势(含.mk文件修改指南)

本文详细解析了在RK3588安卓系统定制中预置第三方输入法的完整流程与关键避坑指南。重点涵盖APK签名、Android.mk文件编写、系统默认输入法配置(使用adb ime list命令获取服务名)以及SeLinux策略适配等核心步骤,并指出RK3566/RK3568等兄弟平台的通用性与差异点,帮助开发者实现稳定、深度的系统集成。

tgb34567890的博客 431

Android GWP-Asan机制详解

基本用途:GWP-ASan是一种原生内存分配器功能,在内存分配时额外记录一些信息,用于检测DOUBLE_FREE、USE_AFTER_FREE、INVALID_FREE、BUFFER_OVERFLOW、BUFFER_UNDERFLOW五种内存错误问题。

专注于系统快稳省领域 4136

VS2015编译配置GDAL(图文并茂、超详细!!!)

文章目录一、GDAL介绍二、下载GDAL三、修改源代码四、工具命令提示符操作五、编译GDAL六、安装GDAL七、在VS2015的项目中配置GDAL八、添加环境变量九、测试是否配置成功 一、GDAL介绍 GDAL(Geospatial Data Abstraction Library)是一个在XMIT许可协议下的开源栅格空间数据转换库。它利用抽象数据模型来表达所支持的各种文件格式。它还有一系列命令行工具来进行数据转换和处理。OGR是GDAL项目的一个分支,功能与GDAL类似,只不过它提供对矢量数据的支持。因此

weixin_46196863的博客 3754

科研党必备:Zotero+Deepseek 打造AI文献阅读助手(附详细插件配置指南)

本文详细介绍了如何利用Zotero和Deepseek打造AI文献阅读助手,提升科研效率。从Zotero基础安装到中文文献处理插件茉莉花的配置,再到Deepseek API的集成与模型选择策略,全面覆盖了AI辅助阅读的关键环节。特别适合需要高效管理海量文献的科研工作者,显著提升文献筛选和分析速度。

backprop5master的博客 412

手把手教你用VL822-QFN88设计一个支持PD快充的Type-C四口HUB(附原理图要点)

本文详细介绍了基于VL822-QFN88芯片设计支持PD快充的Type-C四口HUB的完整流程,包括芯片选型、系统架构设计、原理图要点、PCB布局及固件配置。特别适合硬件工程师和电子设计爱好者,帮助实现高速数据传输与快速充电的多端口扩展方案。

weixin_30832405的博客 507

ArcGIS Pro 3.4 二次开发 - 布局

本文介绍了在ArcGIS Pro SDK 3.4和.NET 8环境下操作布局工程项的相关方法。主要内容包括:引用布局工程项和关联布局,在新视图中打开或激活已有布局视图,引用活动布局视图,导入/移除布局工程项,创建基本布局或带参考线的自定义布局,修改布局页面尺寸,以及创建圆形图形元素等操作。重点演示了如何通过CIM(Core Infrastructure Model)进行高级布局配置,并详细说明了圆形图形元素的创建过程,包括几何构建、符号设置和图形生成。所有涉及UI线程的操作都遵循ArcGIS Pro SDK

Winemonk 791

PyTorch深度学习实战(4)——常用激活函数和损失函数详解

激活函数和损失函数是深度学习模型中重要组成部分,激活函数和损失函数的选择很大程度上决定了深度神经网络的性能和精度,需要根据具体问题的特点和数据分布等因素进行选择。在本节中,将介绍深度学习中常见的激活函数和损失函数,并说明不同函数的常见应用场景。

盼小辉丶的博客 1万+

KUKA机器人修改机器人名称和IP地址的具体方法示例

KUKA机器人修改机器人名称和IP地址的具体方法示例

Robot_PLC_HMI_Automation 5242

深度学习工具包 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")

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

上一篇: PyQt5开发编译器安装(PyCharm安装)
下一篇: PyQt5 布局管理系统详解
三雷科技
三雷科技 领域专家: C/C++技术领域 领域专家: C/C++技术领域
博客等级 码龄17年 5万+粉丝 683原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

三雷科技

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值