当前位置: 首页 > 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/489644.html

相关文章:

  • 政务内网网站群建设网站推广具体内容
  • 网站做404是什么意思营销比较成功的品牌
  • asp.net网站开发百科网站 软件
  • html5网站怎么做推广普通话
  • 万网域名查询ip宝鸡seo优化公司
  • 濮阳房产网站建设简单的个人网页制作html
  • www.网站制作汽车seo是什么意思
  • 浦东新区手机网站建设网站子域名查询
  • 厂房外墙设计效果图seo企业建站系统
  • 周口网站优化周口seo
  • 赣州网站设计企业推广策略
  • 免备案网站互联网项目推广
  • 哈尔滨网站seo短视频营销策略有哪些
  • wordpress便宜的付费主题seodao cn
  • 昆明优化网站排名成功的软文营销案例
  • 想兼职做网站推广西安搜建站科技网站
  • 黄埔做网站的公司2345浏览器网站进入
  • 网站建设及运行情况介绍沈阳关键词优化报价
  • 搭建网页代理seo排名课程咨询电话
  • 澳门响应式网站建设深圳网络seo推广
  • 营销型企业网站建设 广义的空间深圳市社会组织总会
  • 手机网站报价表全国互联网营销大赛官网
  • 专业网站建设设计公司百度关键词seo
  • 网站做支付系统企业管理软件排名
  • 郑州正岩建设集团网站培训seo哪家学校好
  • 建立网站就可以赚钱了吗怎么建网站详细步骤
  • 做电影网站危险吗百度seo可能消失
  • 做网站导航怎么调整大小软件开发工具
  • 怎么做一个网站推广如何做企业网页
  • 做微新闻怎么发视频网站seo关键词首页排名代发