'PyQt Multi Threading

Hi I am trying to make small piece of application and have only a few ideas about threading, I can do simple stuffs to with threading but cannot understand the concepts of "QThread".

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QObject, pyqtSignal, QThread
import sys
import src.backend as backend

class oGUI(QtWidgets.QMainWindow):
    def __init__(self, title, width, height):
        // few code removed
        // few code removed

        self.timer3 = QtCore.QTimer()
        self.timer3.timeout.connect(lambda: update_ram_bar(self))

        self.timer4 = QtCore.QTimer()
        self.timer4.timeout.connect(lambda: update_cpu_bar(self))

        #star all the timers
        self.timer.start(1000)
        self.timer2.start(1000)
        self.timer3.start(1000)
        self.timer4.start(1000)

        sys.exit(self.app.exec_())   

As my debugs when there is only 1 timer started the app works fine as soon as there are multiple instances of timers, the app starts to freeze.

I want someone to fix the freezing part :/. Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source