Qt Gui快速编程 第五章 源码
2018-02-17 18:20
579 查看
5.1 简易对话框# -*-coding: utf-8 -*-
from __future__ import division
from math import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Form(QWidget):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.setObjectName("mainWindow")
widthLabel = QLabel("&width:")
self.widthSpinbox = QSpinBox()
widthLabel.setBuddy(self.widthSpinbox)
self.widthSpinbox.setAlignment(Qt.AlignAbsolute | Qt.AlignCenter)
self.widthSpinbox.setRange(0, 24)
self.beledCheckBox = QCheckBox("&Beveled edges")
sytleLabel = QLabel("&style:")
self.styleComboBox = QComboBox()
sytleLabel.setBuddy(self.styleComboBox)
self.styleComboBox.addItems(["Solid", "Dashed", "Dotted", "DashDotted", "DashDotDotted"])
okButton = QPushButton("&OK")
cancelButton = QPushButton("Cancel")
layout = QGridLayout()
buttonLayout = QHBoxLayout()
buttonLayout.addStretch()
buttonLayout.addWidget(okButton)
buttonLayout.addWidget(cancelButton)
layout.addWidget(widthLabel, 0, 0)
layout.addWidget(self.widthSpinbox, 0, 1)
layout.addWidget(self.beledCheckBox, 0, 2)
layout.addWidget(self.styleComboBox, 1, 1, 1, 2)
layout.addLayout(buttonLayout, 2, 0, 2, 4)
self.setLayout(layout)
if __name__ == '__main__':
app = QApplication(sys.argv)
convertForm = Form()
convertForm.show()
app.exec_()
from __future__ import division
from math import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Form(QWidget):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
self.setObjectName("mainWindow")
widthLabel = QLabel("&width:")
self.widthSpinbox = QSpinBox()
widthLabel.setBuddy(self.widthSpinbox)
self.widthSpinbox.setAlignment(Qt.AlignAbsolute | Qt.AlignCenter)
self.widthSpinbox.setRange(0, 24)
self.beledCheckBox = QCheckBox("&Beveled edges")
sytleLabel = QLabel("&style:")
self.styleComboBox = QComboBox()
sytleLabel.setBuddy(self.styleComboBox)
self.styleComboBox.addItems(["Solid", "Dashed", "Dotted", "DashDotted", "DashDotDotted"])
okButton = QPushButton("&OK")
cancelButton = QPushButton("Cancel")
layout = QGridLayout()
buttonLayout = QHBoxLayout()
buttonLayout.addStretch()
buttonLayout.addWidget(okButton)
buttonLayout.addWidget(cancelButton)
layout.addWidget(widthLabel, 0, 0)
layout.addWidget(self.widthSpinbox, 0, 1)
layout.addWidget(self.beledCheckBox, 0, 2)
layout.addWidget(self.styleComboBox, 1, 1, 1, 2)
layout.addLayout(buttonLayout, 2, 0, 2, 4)
self.setLayout(layout)
if __name__ == '__main__':
app = QApplication(sys.argv)
convertForm = Form()
convertForm.show()
app.exec_()
相关文章推荐
- Python Qt GUI快速编程-第五章的exercise的python3+pytq5+Qt Dersinger实现
- Qt Gui快速编程 第四章 源码
- Python Qt GUI快速编程-第五章的例子Numbers的python3+pytq5+Qt Designer实现
- Python Qt GUI快速编程-第五章的例子pen的python3+pytq5+Qt Designer实现
- C++ GUI QT 编程(第二版) -第4章 实现功能源码简介_1
- 用python3+PyQt5改写Python Qt GUI快速编程的第七章实例Find Dialog
- PYTHON QT GUI快速编程 PYQT编程指南pdf
- Python Qt GUI快速编程-第四章的计算器python3+pytq5+Qt Designer实现
- Python Qt GUI快速编程第六章代码分析
- Python Qt GUI快速编程-第四章的Exercise例子Interest的python3+pytq5+Qt Designer实现
- 用python3+PyQt5改写Python Qt GUI快速编程的第6章实例主窗口
- Python Qt GUI快速编程-第四章的Currency例子的python3+pytq5+Qt Designer实现
- 用python3+PyQt5改写Python Qt GUI快速编程的第6章实例主窗口 信号及槽如何使用
- Python Qt GUI快速编程-第四章的digit的python3+pytq5+Qt Designer实现
- java 快速开发后台框架平台 项目编程源码 SSM springmvc mybatis
- 《C++ GUI Qt 4 编程》 笔记(六)
- VB编程的好帮手--【VB源码之友】快速进阶
- 在C++ GUI Qt中使用QCA进行安全性编程之三
- C++ GUI QT 编程(第二版) -第3章 (创建对话框)_2
- 《CPlusPlusPrimer》第五章编程源码——list类的简单实现