问题
I want to float a window by signal with param in pyqt5. I used already QDockWidget but i can launch only one float window. I need multiple floating window by some pramas. is there any easy way to do this?
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, \
QAction, QTabWidget,QVBoxLayout,QHBoxLayout,QGridLayout,QFrame,QLabel,QSlider,QScrollArea,QCheckBox,QSizePolicy,QFileDialog,QDockWidget, QDialog
class MainWindow(QWidget):
def __init__(self):
super(MainWindow, self).__init__()
scrollarea = QScrollArea(self)
frame1 = QWidget(self)
frame1.setFixedSize(200,200)
frame2 = QWidget(self)
frame2.setFixedSize(200,200)
frame3 = QWidget(self)
frame3.setFixedSize(200,200)
layout = QVBoxLayout(self)
layout.addWidget(frame1)
layout.addWidget(frame2)
layout.addWidget(QPushButton(self))
layout.addWidget(frame3)
container = QFrame(self)
container.setLayout(layout)
# self.setLayout(layout)
scrollarea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scrollarea.setWidgetResizable(True)
scrollarea.setWidget(container)
self.setFixedSize(250,400)
if __name__ == "__main__":
app = QApplication(sys.argv)
mw = MainWindow()
mw.show()
sys.exit(app.exec_())
I want to float individual widget in scroll area.
来源:https://stackoverflow.com/questions/62412871/pyqt5-multiple-floating-window-easy-implement-in-scroll-area