THREAD

QTHREAD

차트등을 그릴때 너무 많은 시간이 걸릴 경우 사용

from PyQt5.QtCore import QThread
class FinancialStatements(QThread):
def __init__(self, parent=None):
    super().__init__()
def run(self):

호출

class MainWindow(QMainWindow, form_class):
def __init__(self):
    super().__init__()
    self.financialStatement = FinancialStatements(MainWindow)
def financialThread(self):
    self.financialStatement.start() // start 호출시 THREAD의 run을 실행

class 호출

import threading
class Crawling(threading.Thread):
    def __init__(self):"
def run(self):
class MainWindow(QMainWindow, form_class):
  def CrawlingDataClicked(self):
    crawling = Crawling()
    crawling.start()

function

import threading, requests, time
 
def getHtml(url):
  resp = requests.get(url)
  time.sleep(1)
  print(url, len(resp.text), ' chars')
 
t1 = threading.Thread(target=getHtml, args=('http://google.com',))
t1.start()```

Table of contents 목차

평점을 남겨주세요
평점 : 2.5
총 투표수 : 1