# -*- coding: utf-8 -*-
"""
-------------------------------------------------
@File:PyQt12_按钮永远在右下角.py
@Desc :
@Version:V 1.0.0
@Author: Maxson King
-------------------------------------------------
"""
#模块倒入
import sys
from PyQt5.Qt import *
# 业务逻辑类方法
class rightfootBtn(QWidget):
'''
Description:分别在光标提示设置Name或Title
'''
def __init__(self, parent = None):
super(rightfootBtn,self).__init__(parent)
# 设置属性
self.setWindowTitle('按钮永远在右下角')
self.resize(500, 300)
okButton = QPushButton("确定")
cancelButton = QPushButton("取消")
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addWidget(okButton)
hbox.addWidget(cancelButton)
vbox = QVBoxLayout()
btn1 = QPushButton("按钮1")
btn2 = QPushButton("按钮2")
btn3 = QPushButton("按钮3")
vbox.addStretch(0)
vbox.addWidget(btn1)
vbox.addWidget(btn2)
vbox.addWidget(btn3)
vbox.addStretch(1)
vbox.addLayout(hbox)
self.setLayout(vbox)
if __name__ == '__main__':
# 创建应用程序实例
app = QApplication(sys.argv)
# 展示控件
window = rightfootBtn()
window.show()
# 应用程序的执行, 进入到消息循环
sys.exit(app.exec_())
免责声明:文中图片均来源于网络,如有版权问题请联系我们进行删除!