PyQt5筆記(01) – 建立空白窗體
PyQt5筆記(02) – 按鈕點擊事件
PyQt5筆記(03) – 消息框
PyQt5筆記(04) – 文本框的使用
PyQt5筆記(05) – 絕對位置
爲了便於後期更新,全部目錄已彙總到一個連接,具體請移步到這裏html
本節主要介紹PyQt5裏絕對位置的使用app
import sys from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QMainWindow from PyQt5.QtGui import QIcon class App(QWidget): def __init__(self): super().__init__() self.title = 'PyQt absolute positioning' self.left = 30 self.top = 30 self.width = 440 self.height = 280 self.initUI() def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) label = QLabel('Python', self) label.move(50, 50) label2 = QLabel('PyQt5', self) label2.move(100, 100) label3 = QLabel('Examples', self) label3.move(150,150) label4 = QLabel('pytonspot.com', self) label4.move(200,200) self.show() if __name__ == '__main__': app = QApplication(sys.argv) ex = App() sys.exit(app.exec_())
效果以下:
ui