Caros, alguém poderia me dar uma ajuda? Por que no script abaixo acontece o erro 'global name is not defined'... na linha sublinhada ? #!/usr/bin/python
# -*- coding: cp1252 -*-
import sys
from PyQt4 import QtGui, QtCore
class Main(QtGui.QDialog):
def __init__(self, parent=None):
# Formulário
QtGui.QDialog.__init__(self, parent)
self.setGeometry(200,200, 165, 130) # Geometria (X, Y, Comprimento, Altura)
self.setWindowTitle('Teste') # Título do Formulário
# Edit
lblTexto = QtGui.QLabel('Texto', self)
lblTexto.setGeometry(5, 0, 100, 25)
edtTexto = QtGui.QLineEdit('', self)
edtTexto.setGeometry(5, 23, 155, 23)
# Cria o botão OK
btnOK = QtGui.QPushButton('OK', self)
btnOK.setGeometry(5, 50, 75, 25)
self.connect(btnOK, QtCore.SIGNAL('clicked()'), self.ExibeTexto)
def ExibeTexto(self):
msg = QtGui.QMessageBox.information(self, "Informaçao", [u]edtTexto.text[/u], QtGui.QMessageBox.Close)
app = QtGui.QApplication(sys.argv)
qb = Main()
qb.show()
sys.exit(app.exec_()) abraços a todos! Juliano