hey all I've searched all over the web and i didn't get a solution!
what should i do to take the text from the 'urlT' line edit? is there another way?
Nameerror
"global name 'self' is not defined"
whats wrong with it?
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setWindowModality(QtCore.Qt.NonModal)
MainWindow.resize(640, 483)
MainWindow.setMinimumSize(QtCore.QSize(640, 483))
MainWindow.setMaximumSize(QtCore.QSize(640, 483))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/logo/welcome-logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
MainWindow.setTabShape(QtGui.QTabWidget.Triangular)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.urlT = QtGui.QLineEdit(self.centralwidget)
self.urlT.setEnabled(True)
self.urlT.setGeometry(QtCore.QRect(10, 20, 521, 27))
self.urlT.setObjectName("urlT")
self.checkurlB = QtGui.QPushButton(self.centralwidget)
self.checkurlB.setGeometry(QtCore.QRect(540, 20, 91, 27))
self.checkurlB.setObjectName("checkurlB")
QtCore.QObject.connect(self.checkurlB, QtCore.SIGNAL("clicked()"), checkurl())
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def checkurl():
import urllib2
url=str(self.urlT.text()) #the error line
try:
response = urllib2.urlopen(url)
except URLError, e:
#pass or do something
pass