使用Python的Qt库可以快速构建图形用户界面。在Qt中,工具按钮是一种常见的控件,它可以通过设置不同的popupMode属性来实现不同的弹出菜单效果。

使用Python的Qt库可以快速构建图形用户界面。在Qt中,工具按钮是一种常见的控件,它可以通过设置不同的popupMode属性来实现不同的弹出菜单效果。

popupMode属性有三个取值:QToolButton.DelayedPopup、QToolButton.MenuButtonPopup和QToolButton.InstantPopup,分别代表延迟弹出、菜单按钮弹出和直接弹出。下面我们将分别演示这三种弹出菜单效果的实现。

首先,我们创建一个QMainWindow窗口,并在其中添加一个工具按钮。

from PyQt5.QtWidgets import QMainWindow, QToolBar, QToolButton

class MyWindow(QMainWindow):
    
Python学习笔记(四)QT开发图形界面总结 基于python QTside2 的图形化开发总结 阅读详情

相关推荐

Python学习笔记——开发图形界面wxPython、PyQt、PySide选哪一个?

我个人感觉,Tkinter过于简单,组件不是很齐全。wxPython组件比较丰富,做一些工具软件或小型软件是完全没问题的。以后做复杂一点的需求,就考虑用PySide6以及后续版本。毕竟它跟wxPython一样也是LGPL协议的,而且PySide6是Qt亲生的。PyQt虽然也很优秀,但是它的双重许可总让人觉得有点忐忑。......

cc的专栏 9357

一、PyQt5实现Python界面设计_QtWidgets (第一个窗体界面)

1、PyQt是一个创建GUI应用程序的工具包。它是Python编程语言和Qt库的成功融合。3、注意使用面对对象方式进行开发,以便后续的更改与开发。(1)界面与逻辑分离(2)事件与设计分离。

m0_59160272的博客 1万+

使用PyQt打造Python图形化界面

在这个代码中,我们定义了一个MyWindow类,继承自QWidget类,并在其中实现了init_ui()方法,用于创建窗口和按钮等组件,并进行布局。在这个代码中,我们首先导入了必要的模块,然后创建了一个应用对象app和一个QWidget对象window,设置了窗口的标题和初始大小,最后通过show()方法显示窗口并调用exec_()方法进入程序的主循环中。以上就是使用PyQt进行Python图形界面程序开发的简单示例,通过掌握相关知识和技能,我们可以创建出更加复杂和实用的图形化界面应用程序。

持续更新 1189

使用PyQt开发图形界面Python应用专栏目录

本专栏为收费专栏的文章目录,对应的免费专栏为《[PyQt入门知识目录](https://blog.youkuaiyun.com/laoyuanpython/category_9702362.html)》,两个专栏都为基于PyQt的Python图形界面开发基础教程,只是收费专栏中的内容介绍更深入、案例代码更全。 Qt和PyQt介绍的很多部件属性及字典取值在Qt及PyQt官方文档以及网上都没有,老猿通过大量研究、测试将相关内容弄清楚,因此本专栏适合有一定Python基础的同仁零基础学习Python图形界面开发,也适合学习

老猿Python 1万+

使用Python和Qt实现界面和逻辑的开发

在Python中,我们可以使用Qt库来创建图形用户界面(GUI)应用程序。Qt是一个功能强大且跨平台的GUI工具包,它提供了许多可以用于创建各种界面元素的类和函数。在本文中,我们将介绍如何使用Python和Qt来开发界面和逻辑,并提供相应的源代码示例。

FuJavascript的博客 481

Python Selenium自动化浏览器实战:从环境搭建到高级技巧

浏览器自动化是现代软件开发与数据处理中的关键技术,它通过程序模拟用户操作,实现网页交互的自动化执行。其核心原理是基于WebDriver协议,通过驱动程序与浏览器进行通信,从而控制浏览器的各种行为。这项技术的价值在于能够将重复性高、耗时长的Web操作转化为可编程、可复用的脚本,极大提升工作效率和准确性。在应用场景上,它广泛覆盖了Web自动化测试、数据采集与爬虫、日常办公流程自动化以及RPA(机器人流程自动化)等多个领域。本文聚焦于Python环境下Selenium这一经典工具,深入讲解其环境配置、八大元素定位

anwenzhao0749的博客 445

手把手教你解决COLMAP编译中的Ceres CUDA支持问题(附详细配置步骤)

本文详细解析了COLMAP编译中Ceres CUDA支持问题的完整解决方案,包括环境准备、Ceres Solver的CUDA编译配置、COLMAP的CUDA集成配置等关键步骤。通过优化CMake参数和解决常见错误,帮助技术人员充分利用GPU加速优势,提升三维重建效率。

vodka的博客 861

QT项目实战:如何在正点原子Linux开发板上集成CVR-100UC身份证阅读器(附完整代码)

本文详细介绍了在正点原子Linux开发板上集成CVR-100UC身份证阅读器的完整实战流程。内容涵盖驱动适配、库文件部署、QT项目框架搭建、核心功能封装以及界面集成,并提供了完整的代码示例,帮助开发者快速实现嵌入式环境下的身份证信息读取功能。

yyy34的博客 258

BEVFormer vs BEVFusion:5个关键差异点帮你选对环视感知方案

本文深入对比了自动驾驶领域两大主流环视感知方案BEVFormer与BEVFusion。BEVFormer作为纯视觉BEV感知的标杆,通过注意力机制隐式学习深度,成本较低;而BEVFusion作为多模态融合典范,融合激光雷达与摄像头数据,在性能、小目标检测及极端环境鲁棒性上优势显著。文章从计算效率、部署成本、数据依赖性等五个核心维度提供选型指南,帮助技术决策者根据自身算力预算与传感器配置做出明智选择。

weixin_29306011的博客 124

基于simulink的BMS系统中电池单体故障隔离与恢复建模

本文介绍了使用Simulink构建BMS电池单体故障诊断与容错控制模型的方法。主要内容包括:1)搭建12串锂电池组模型;2)实现单体故障注入(过压、断线等);3)设计故障诊断与隔离模块(采用Stateflow状态机);4)开发恢复判断逻辑(需满足电压、温度等条件);5)系统监控与仿真设置。文章还提供了工程实践建议,如防环流设计、通信冗余等,并指出进阶方向(多故障处理、AI预警等)。该模型适用于新能源汽车、储能系统的BMS设计,可提高系统可靠性和安全性。

xiaoheshang_123的博客 140

2026国内Claude Code保姆级教程:安装、避坑、防串台全优化

安装 Claude Code CLI + 切换 npm 国内镜像优先配置固定关闭:自动联网、自动项目扫描VSCode 内置终端直接用,不装多余插件会话隔离+指令约束,彻底解决 Rust、小程序 跨语言串台。

lpfasd123的博客 2553

微信小程序 - 超详细小程序接入腾讯地图的完整流程,提供地图显示、IP 属地定位、地理位置名称、获取经纬度等超多功能示例(可一键复制并运行的功能源代码,详细的注释及常见问题汇总)小白直接上手!

微信小程序腾讯地图怎么接入,小程序项目中使用腾讯地图sdk,小程序中使用腾讯地图,微信小程序集成腾讯地图功能,微信小程序通过ip获取其地址、经纬度、详细地址,小程序使用腾讯地图跨域解决方法,微信小程序引入腾讯地图详细教程,原生小程序引入腾讯地图,微信小程序如何植入腾讯地图,微信小程序腾讯地图配置及使用详细教程,小程序植入腾讯地图SDK,微信小程序项目怎么用腾讯地图,微信小程序IP属地定位,获取当前用户位置名称,微信小程序如何使用腾讯地图获取用户的定位位置,在小程序中使用腾讯地图,实现定位,距离计算,实时搜索

🏆 前端领域优质创作者 8805

从一个 ASIN 看透亚马逊:商品模型背后的增长飞轮

在亚马逊电商体系中,每件商品背后都有一套严密的商品建模逻辑。本篇文章以“ASIN 的一生”为线索,系统拆解了亚马逊的商品模型:从飞轮战略出发,剖析 SDP(Single Detail Page)机制如何实现标准化展示;再到 ASIN 编码、父子变体结构与 Offer 分离模型,逐层解析商品信息如何被建构、聚合与呈现。通过图解与案例,文章帮助读者理解商品建品流程、同款聚合原则、价格控制机制等核心逻辑,避免常见运营误区,是一份面向运营、产品、技术人员的实用参考指南。

曾经“等你生日那天”都遥远得像未来,如今却可欢愉的挥手说“下个十年见” 13万+

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

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

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

上一篇: 使用Python中的nlargest函数进行数据处理
下一篇: 使用Python编写GUI应用程序时,经常需要使用QDockWidget停靠部件来实现窗口的拆分和布局
普通网友
博客等级 码龄4年 1009粉丝 1545原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值