pyqt5 学习笔记五(QGridLayout)网格布局

这篇博客是PyQt5学习笔记的第五部分,主要聚焦于QGridLayout的使用。内容包括QGridLayout的创建、控件的跨行跨列设置,以及如何将QGridLayout布局添加到垂直布局中。博客提供了相关参考链接和代码示例。
摘要由CSDN通过智能技术生成

pyqt5 学习笔记五 (布局:QGridLayout)

写在前面:
①本教程使用pycharm编译器进行pyqt5的学习,安装教程请大家自行百度
②本系列博客根据B站王铭东博主教程学习 学习代码 笔记5
链接:https://pan.baidu.com/s/1i3y4mI_9N84iAC6tav-j8Q
提取码:gupx
资料:
【1】B站教程
【2】B站教程配套课件
【3】PyQt官网的所有模块 (有部分内容没有补充进去)
【4】C++具体实现的API文档

布局器

共有四种:
QBoxLayout:垂直水平布局器
QGridLayout:网格布局器
QFormLayout:表单布局器
QStackedLayout:抽屉布局器

(一)字典

参考链接:
【1】python字典:https://blog.csdn.net/weixin_40581859/article/details/126235852
【2】enumerate() 函数:https://www.runoob.com/python/python-func-enumerate.html

1、字典的遍历 items()
data = {
   
   0: ["7", "8", "9", "+", "("],
   1: ["4", "5", "6", "-", ")"],
   2: ["1", "2", "3", "*", "<-"],
   3: ["0", ".", "=", "/", "C"]
}
for temp in data.items():
   print(temp)
for temp1, temp2 in data.items():
   print("temp1:", temp1)
   print("temp2:", temp2)

temp输出:

(0, ['7', '8', '9', '+', '('])
(1, ['4', '5', '6', '-', ')'])
(2, ['1', '2', '3', '*', '<-'])
(3, ['0', '.', '=', '/', 'C'])

temp1与temp2输出:

temp1: 0
temp2: ['7', '8', '9', '+', '(']
temp1: 1
temp2: ['4', '5', '6', '-', ')']
temp1: 2
temp2: ['1', '2', '3', '*', '<-']
temp1: 3
temp2: ['0', '.', '=', '/'
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值