代码的gui应该可以正常工作,并且所有内容都会打开,但是当我尝试单击按钮时,程序无论如何都没有响应,这怎么解决? 设计文件也可以在这里找到,https://pastebin.com/riENQWc2
from googlesearch import search
import urllib.request as urllib
from bs4 import BeautifulSoup
from detective import Analyzer as Detective
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
from design import Ui_Lartzer
from PyQt5.QtCore import pyqtSlot
class AdvancedSearch:
def __init__(self):
self.urls = []
self.titles = []
def google_scrape(self, url):
thepage = urllib.urlopen(url)
soup = BeautifulSoup(thepage, "html.parser")
self.urls.append(url)
self.titles.append(soup.title.text)
return soup.title.text
class Run(Ui_Lartzer):
def __init__(self, dialog):
Ui_Lartzer.__init__(self)
self.setupUi(dialog)
# Connect "add" button with a custom function (addInputTextToListbox)
self.search.clicked.connect(self.searchInfo)
# @pyqtSlot()
def searchInfo(self):
print("oof")
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
window = QMainWindow()
dialog = QtWidgets.QDialog()
prog = Run(window)
ui = Ui_Lartzer()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())