小编Kir*_*Soo的帖子

如何使用 PyQt4 GUI 编辑 yaml 文件

因此,我尝试创建一个简单的 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)

python user-interface yaml pyqt4

1
推荐指数
1
解决办法
3070
查看次数

标签 统计

pyqt4 ×1

python ×1

user-interface ×1

yaml ×1