目录
pyqt开源漂亮界面
有哪些设计较好的开源 PyQt/Qt/Qml 应用? - 知乎
播放器:
GitHub - HuberTRoy/MusicBox: MusicPlayer 一站式收听多平台音乐(网易云, 虾米, QQ)的跨平台音乐播放器,尽情享受吧~
白色播放器:
https://github.com/harry159821/XiamiForLinuxProject
pyqt QGridLayout示例
原文:pyqt布局管理器QGridLayout简单示例
import sys
from PyQt5.QtWidgets import *
class Example(QWidget):
def __init__(self):
super(Example,self).__init__()
self.grid = QGridLayout()
self.initUI()
self.setWindowTitle('grid layout')
def initUI(self):
while self.grid.count():
item = self.grid.takeAt(0)
widget = item.widget()
# if widget has some id attributes you need to
# save in a list to maintain order, you can do that here
# i.e.: aList.append(widget.someId)
widget.deleteLater()
names=['Cls','Bck','','Close','7','8','9','/','4',
'5','6','*','1','2,','3','-','0','.','=','+']
j=0
pos=[(0,0),(0,1),(0,2),(0,3),
(1,0),(1,1),(1,2),(1,3),
(2,0),(2,1),(2,2),(2,3),
(3,0),(3,1),(3,2),(3,3),
(4,0),(4,1),(4,2),(4,3)]
for iterm in names:
button=QPushButton(iterm)
if j==2:
change=QPushButton(u'文本编辑器')
self.grid.addWidget(change,0,2)
change.clicked.connect(self.otherUI)
else:
self.grid.addWidget(button,pos[j][0],pos[j][1])
j=j+1
self.setLayout(self.grid)
self.resize(300,300)
def otherUI(self):
while self.grid.count():
item = self.grid.takeAt(0)
widget = item.widget()
# if widget has some id attributes you need to
# save in a list to maintain order, you can do that here
# i.e.: aList.append(widget.someId)
widget.deleteLater()
title=QLabel('Title')
author=QLabel('Author')
review=QLabel('Review')
titleEdit=QLineEdit()
authorEdit=QLineEdit()
reviewEdit=QTextEdit()
self.grid.setSpacing(10)
self.grid.addWidget(title,1,0)
#addWidget(self, a0: QWidget, row: int, column: int, rowSpan: int, columnSpan: int
self.grid.addWidget(titleEdit,1,1,1,2)
self.grid.addWidget(author,2,0)
self.grid.addWidget(authorEdit,2,1)
self.grid.addWidget(review,3,0)
self.grid.addWidget(reviewEdit,3,1,5,1)
back=QPushButton(u'返回')
back.clicked.connect(self.initUI)
self.grid.addWidget(back,6,2)
self.setLayout(self.grid)
self.resize(300,300)
app=QApplication(sys.argv)
ex=Example()
ex.show()
sys.exit(app.exec_())