import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
def window():
app = QApplication(sys.argv)
win = QWidget()
b1 = QPushButton("Button1")
b2 = QPushButton("Button2")
# 按垂直方向排列元件
vbox = QVBoxLayout()
vbox.addWidget(b1)
vbox.addStretch()
vbox.addWidget(b2)
# 按水平方向排列元件
hbox = QHBoxLayout()
b3 = QPushButton("Button3")
b4 = QPushButton("Button4")
hbox.addWidget(b3)
hbox.addStretch()
hbox.addWidget(b4)
vbox.addStretch()
# hbox當作一個元件讓vbox可以add,且按照垂直方向排列
vbox.addLayout(hbox)
win.setLayout(vbox)
win.setWindowTitle("PyQt")
win.show()
sys.exit(app.exec_())
if __name__ == '__main__':
window()
https://www.tutorialspoint.com/pyqt5/pyqt5_qboxlayout_class.htm
PyQt5
因不支援副檔名為xmls的檔案,故須透過 offiece 轉成xls,也不能直接從檔名改,否則一樣不支援 Ref. Localizable.strings2Excel
Jun 1, 2022Ref. Python内置库:configparser(INI格式配置文件解析)
Oct 25, 2021Ref. 【python的異常處理】異常的捕捉
Jul 22, 2021調整了範例,讓 timer t 可在任意位置取消 timer 的運作,指令 t.cancel() import threading # global t t = None def set_interval(func, sec): global t
Jul 21, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up