setlabel in Qlabel will assign a variable in pyqt?
I'm still starting out with PyQt with QtDesigner using eric4 (and still studying python as a whole).
Anyway, as I'v开发者_JS百科e designed in a GUI using QtDesigner I've just made a Qlabel as a placeholder which is intended to update with the latest ID that has access to a SQLite database which I'm building. I want it to setlabel to change to the next slot available in ID primary key but I honestly don't know how.
I've tried to change the UI compiled form as I noticed that it is this line:
self.ID_Number.setText(QtGui.QApplication.translate("Dialog","IDLabel", None, QtGui.QApplication.UnicodeUTF8))
that sets the label of the supposed ID_Number which would communicate with the SQLite. But I always get a compiling error when I changed "IDLabel" to a variable. I've checked that it is supposed to be a constant but would it be possible that it can be a variable instead? Or am I doing wrong to use a QLabel in QtDesigner and I should use something else?
Any help in solving the wall I'm trying break is very much appreciated bows deeply
The translate
function call is used for multi-language support. You can remove it in this case and simplify the code to the following.
self.ID_Number.setText(somePythonStringVariable)
精彩评论