我试图解决这个错误两个小时,并搜索了每个可能的论坛,然后才转到此处发布主题。PyQt全局名称'...'未定义
正在发生的错误是在第38行
self.statusBar().showMessage(inputt)
任何帮助,将不胜感激:)
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ZetCode PyQt4 tutorial
In this example, we determine the event sender
object.
author: Jan Bodnar
website: zetcode.com
last edited: October 2011
"""
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QMainWindow):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
btn1 = QtGui.QPushButton("Button 1", self)
btn1.move(30, 50)
btn1.clicked.connect(self.buttonClicked)
inputt = QtGui.QLineEdit(self)
self.statusBar()
self.setGeometry(300, 300, 290, 150)
self.show()
def buttonClicked(self):
self.statusBar().showMessage(inputt)
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
你真的认为任何人都有兴趣计算你的台词吗? –
什么是全球性的? – eyllanesc
请在阅读后编辑您的问题http://stackoverflow.com/help/mcve – chepner