2018-02-01 回答
这是pyqt4的代码:(你想要安装才可以使用)
from pyqt4 import qtcore, qtgui
class ui_helloword(object):
def setupui(self, helloword):
helloword.setobjectname("helloword")
helloword.resize(400, 300)
self.label = qtgui.qlabel(helloword)
self.label.setgeometry(qtcore.qrect(70, 80, 54, 12))#位置
self.label.setobjectname("label")
self.retranslateui(helloword)
qtcore.qmetaobject.connectslotsbyname(helloword)
def retranslateui(self, helloword):
helloword.setwindowtitle(qtgui.qapplication.translate("helloword", "form", none, qtgui.qapplication.unicodeutf8))
self.label.settext(qtgui.qapplication.translate("helloword", "你好世界", none, qtgui.qapplication.unicodeutf8))
if __name__ == "__main__":
import sys
app = qtgui.qapplication(sys.argv)
helloword = qtgui.qwidget()
ui = ui_helloword()
ui.setupui(helloword)
helloword.show()
sys.exit(app.exec_())