我試圖解決這個錯誤兩個小時,並搜索了每個可能的論壇,然後才轉到此處發佈主題。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