0
여기 내 코드가 있습니다. 나는 당신이 드롭 다운 박스를 바꿀 때 동적으로 입력을위한 QLineEdits를 더 많이 또는 적게 표시 할 수 있도록하려고 노력 중이다. 이 테스트의 단지 최신의 반복이다요소에서 동적으로 요소를 추가/제거 할 수 있습니까?
import sys
from PyQt5.QtWidgets import (QWidget, QPushButton, QLineEdit,
QInputDialog, QApplication, QComboBox, QFrame)
import numpy as np
class GUI(QWidget):
def __init__(self):
super().__init__()
self.initgui()
def initgui(self):
#
# Set up GUI
#
self.setGeometry(100, 100, 400, 400)
self.move(300, 300)
combobox = QComboBox(self)
for i in range(1, 10, 1):
combobox.addItem(str(i + 1))
combobox.activated[str].connect(self.comboboxchanged)
self.setWindowTitle("Testing Easy Setup")
self.show()
def comboboxchanged(self, text):
frame = QWidget(self)
frame.hide()
for num in range(0, int(text), 1):
QLineEdit(frame).move(60, num * 19)
frame.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
gui = GUI()
sys.exit(app.exec_())
대단히 감사합니다! 정확히 내가 찾던 것이 아니었지만, 코드는 내가 궁극적 인 해결책을 얻는 데 필요한 것을 충분히 설명했다. –