当前位置: 首页 > wzjs >正文

多语种网站企业建站用什么好

多语种网站,企业建站用什么好,东莞外发加工货源网,成都哪家做网站好QBoxLayout(框布局) 采用QBoxLayout类可以在水平和垂直方向上排列控件,QHBoxLayout和 QVBoxLayout类继承自QBoxLayout类。 QHBoxLayout(水平布局) 采用QHBoxLayout类,按照从左到右的顺序来添加控件。QHBoxL…

QBoxLayout(框布局)

采用QBoxLayout类可以在水平和垂直方向上排列控件,QHBoxLayout和
QVBoxLayout类继承自QBoxLayout类。

QHBoxLayout(水平布局)

采用QHBoxLayout类,按照从左到右的顺序来添加控件。QHBoxLayout类中的
常用方法如表6-1所示。

方法描述
addLayout(self,QLayout,stretch=0)在窗口的右边添加布局,使用stretc(伸缩量)进行伸,
伸缩量默认为0
addWidget(self,QWidget,stretch,Qt.Alignment alignment)在布局中添加控件:- stretch(伸缩量),只适用于QBoxLayout,控件和窗口会随着伸缩量的变大而增大- alignment,指定对齐的方式
addSpacing(self,int)设置各控件的上下间距.通过该方法可以增加额外的空间
QHBoxLayout类的继承结构如下:
在创建QHBoxLayout布局时用到的对齐方式参数如表6-2所示。
参数描述
Qt.AlignLeft水平方向居左对齐
Qt.AlignRight水平方向居右对齐
Qt.AlignCenter水平方向居中对齐
Qt.ALignJustify水平万向两端对齐
Qt.AlignTop重直方向上对齐
Qt.AlignBottom垂直方向靠下对齐
Qt.AlignVCenter垂直方向居中对齐
import sys
from PyQt5.QtWidgets import QApplication,QWidget,QHBoxLayout,QPushButtonclass Winform(QWidget):def __init__(self,parent=None):super(Winform,self).__init__(parent)self.setWindowTitle("水平布局管理例子")#水平布局按照从左到右的顺序进行添加按钮部件hlayout = QHBoxLayout()hlayout.addWidget(QPushButton(str(1)))hlayout.addWidget(QPushButton(str(2)))hlayout.addWidget(QPushButton(str(3)))hlayout.addWidget(QPushButton(str(4)))hlayout.addWidget(QPushButton(str(5)))self.setLayout(hlayout)if __name__ == '__main__':app = QApplication(sys.argv)form = Winform()form.show()sys.exit(app.exec_())

运行结果

image

QVBoxLayout(垂直布局)

import sys
from PyQt5.QtWidgets import QApplication,QWidget,QVBoxLayout,QPushButtonclass Winform(QWidget):def __init__(self,parent=None):super(Winform,self).__init__(parent)self.setWindowTitle("垂直布局管理例子")self.resize(330,150)#垂直布局按照从上到下的顺序进行添加按钮部件vlayout = QVBoxLayout()vlayout.addWidget(QPushButton(str(1)))vlayout.addWidget(QPushButton(str(2)))vlayout.addWidget(QPushButton(str(3)))vlayout.addWidget(QPushButton(str(4)))vlayout.addWidget(QPushButton(str(5)))self.setLayout(vlayout)if __name__ == '__main__':app = QApplication(sys.argv)form=Winform()form.show()sys.exit(app.exec_())

运行结果

image

addStretch()函数的使用

在布局时要用到addStretch()函数。设置stretch伸缩量后,按比例分配剩余空间。
addStretch()函数的具体使用请参考表6-3。

函数描述
QBoxLayout.addStretch(int stretch=0)addStretch()函数在布局管理器中增能一个可伸缩的控件(QSpaceItem),0
为最小值,并且将stretch作为伸缩量添加到布局末尾
streteh参数表示均分的比例,默认值为0
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton
import sysclass WindowDemo(QWidget):def __init__(self):super().__init__()btn1 = QPushButton(self)btn2 = QPushButton(self)btn3 = QPushButton(self)btn1.setText('button 1')btn2.setText('button 2')btn3.setText('button 3')hbox = QHBoxLayout()# 设置伸缩量为1hbox.addStretch(1)hbox.addWidget(btn1)# 设置伸缩量为1hbox.addStretch(1)hbox.addWidget(btn2)# 设置伸缩量为1hbox.addStretch(1)hbox.addWidget(btn3)# 设置伸缩量为1hbox.addStretch(1)self.setLayout(hbox)self.setWindowTitle("addStretch 例子")if __name__ == "__main__":app = QApplication(sys.argv)win = WindowDemo()win.show()sys.exit(app.exec_())

运行结果

image

http://www.dtcms.com/wzjs/244428.html

相关文章:

  • 2014做网站如何使用网络营销策略
  • 源代码开发网站河南企业站seo
  • 装修三维效果图软件新乡网站优化公司
  • 鄂州做网站的公司网络推广有多少种方法
  • 常州网站建设哪家好推广引流网站
  • 百度站长链接提交平台2024年4月新冠疫情结束了吗
  • 龙海市邦策网站建设平台网站排名seo
  • 怎么做卖卷网站爱站seo工具
  • 用书籍上的文章做网站更新网站如何做优化排名
  • 公司网站建设多少钱浙江网站建设营销
  • 企业网站建设方案范本免费网站可以下载
  • 网站分析步骤站长推荐
  • 本地企业网站建设服务磁力搜索器kitty
  • 北京和田合瑞建设有限公司网站百度爱采购服务商查询
  • 领手工在家做的网站2019百度推广做二级域名
  • matebook e 网站开发网站推广软件排名
  • 公司商业网站怎么做厦门百度快照优化排名
  • wordpress主题美化插件百度seo发帖推广
  • 中餐网站模板怎么创建网站链接
  • 服务好的南昌网站制作网站制作公司排名
  • 做网络歌手的网站长尾关键词挖掘词
  • 如果做微商需不需要开个网站。百度软件下载
  • 俄文企业网站建设怎么注册一个自己的网址
  • django做的网站赣州网站建设
  • 桂林最新新闻泰安seo
  • 简述网站开发岗位及职务2345系统导航
  • 郑州注册公司网上核名网站百度官方
  • 成人大专报名时间新乡网站优化公司价格
  • 网站建设怎么改栏目名称守游网络推广平台
  • 室内设计欣赏网站西安网络科技公司排名