title: WebScraping, PyQt
body: <p>I've been working on a really simple script that gets the question titles from the python tag in stackoverflow and shows them in a QTextBrowser.</p>
  
  <p>The application works as expected(at least at the beggining) but the Window doesn't show untill it finishes loading the webpage and the refresh button freezes the program until it loads too is there a way to fix this problem? Here's The full code:</p>
  
  <pre><code>#! usr/bin/env python
  
  from PyQt4.QtGui import *
  import requests
  from bs4 import BeautifulSoup
  import lxml
  from threading import Thread
  
  class Form(QWidget):
      def __init__(self, parent=None):
          super(Form, self).__init__(parent)
  
          self.url = "http://www.stackoverflow.com/questions/tagged/python"
  
          self.browser = QTextBrowser() 
          self.connectionlabel = QLabel()
  
          self.refreshBtn = QPushButton("Refresh")
          self.refreshBtn.clicked.connect(self.get)
  
          layout = QGridLayout()
          layout.addWidget(self.connectionlabel, 0, 0)
          layout.addWidget(self.refreshBtn, 0, 1)
          layout.addWidget(self.browser, 1, 0,1,2)
  
          self.setLayout(layout)
          self.setWindowTitle("StackOverflow: Python")
  
  
      def get(self):
          self.browser.clear()
          self.connectionlabel.setText("Connecting.....")
          try:
              response = requests.get(self.url)
              soup = BeautifulSoup(response.content, 'lxml')
  
              self.connectionlabel.setText("Connected.")
  
              questions = soup.find_all("a", {"class": "question-hyperlink"})
  
              for i, questionTitle in enumerate(questions):
                  try:
                      self.browser.append("\n"+str(i+1)+". "+questionTitle.text)
                  except:
                      pass
  
          except:
              self.connectionlabel.setText("Couldn't connect.")
  
  if __name__ == '__main__':
      import sys
      app = QApplication(sys.argv)
      screen = Form()
      screen.show()
      t = Thread(screen.get)
      t.deamon = True
      t.start()
      sys.exit(app.exec_())
  </code></pre>