Assign string to QLineEdit with PySide/PyQt

别来无恙 提交于 2019-12-02 14:54:14

As the comment states, the error is on this line:

self.lineEditUser.setText() = 'John'

You are attempting to assign the value 'John' to that functioncall (as the error states). If you review the documentation for QLineEdit in PyQT, you'll see that QLineEdit.setText() requires a string to be passed to it.

So, what you need to do instead is pass the value 'John' to the function like so:

self.lineEditUser.setText('John')

On another note your idea that your

software package will have about 10 windows

is definitely something that you want to reexamine. More windows, especially when undocked and floating independently will no doubt cause usability issues. I'd strongly recommend sharing your ideas over at UserExperience.SE.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!