因此,我尝试创建一个简单的 GUI,它采用 yaml 文件并通过 PyQT 对其进行编辑。假设 yaml 包含 {example: "Helloworld"}
我什至无法在 GUI 框中显示 yaml。
所以我用 python 编写了 GUI 文本框:
import yaml
import sys
from PyQt4 import QtGui, QtCore
class GUI(QtGui.QWidget):
def __init__(self):
super(GUI, self).__init__()
self.initUI()
def initUI(self):
msg = QtGui.Qlabel("This is a test message")
self.msg.move(60, 20)
self.addedLine = QtGui.QLabel(self)
textBox = QtGui.QLineEdit(self)
textBox.move(60, 100)
self.addedLine.move(60, 40)
textBox.textChanged[str].connect(self.onChanged)
self.setGeometry(500, 500, 500, 500)
self.setWindowTitle('QtGui.QLineEdit')
self.show()
def onChanged(self, text):
self.addedLine.setText(text)
self.addedLine.adjustSize()
def main():
app = QtGui.QApplication(sys.argv)
ex = GUI()
sys.exit(app.exec_())
if __name__ == …Run Code Online (Sandbox Code Playgroud)