import threading, random, sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5 import QtCore, QtTest
def update():
while True:
n = random.randint(0,22)
QtTest.QTest.qWait(500)
threading.Thread(target=update, daemon = True).start()
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setFixedSize(200, 200)
self.labl.setText("value of n goes here")
window = MainWindow()
window.show()
sys.exit(app.exec_())
import threading, random, sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5 import QtCore, QtTest
def update():
while True:
n = random.randint(0,22)
QtTest.QTest.qWait(500)
threading.Thread(target=update, daemon = True).start()
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setFixedSize(200, 200)
self.labl = QLabel(self)
self.labl.setText("value of n goes here")
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
Bookmarks