I have a seperate script that calls this one... I don't understand why my button click is not going into the corresponding function. I am quite new at this so if you do know the answer, could you explain it to me so that I can learn it.
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class Window (QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.urlEdit = QLineEdit()
self.windowWid = QWidget()
urlLabel = QLabel("Enter website to scrape:")
self.urlEdit.setFixedHeight(30)
self.urlEdit.setFixedWidth(200)
layout = QGridLayout(self.windowWid)
layout.addWidget(urlLabel, 0, 0)
layout.addWidget(self.urlEdit, 0, 1)
done = QPushButton("Done",self)
done.setFixedWidth(60)
layout.addWidget(done,2,3)
layout.setRowStretch(4, 1)
layout.setColumnStretch(4,1)
done.clicked.connect(self.grabtext)
def grabtext(self):
print("CANT REACH HERE")
answer = self.urlEdit.text()
print(answer)