Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import time
- from GUI import *
- from PyQt5 import QtCore, QtGui, QtWidgets
- from threading import Thread
- class MyWin(QtWidgets.QMainWindow):
- #d = [
- #{'id': 1, 'quest': 'здесь вопрос ', 'answers': (1, 2, 3, 4), 'right_answer': 2-1},
- #{'id': 2, 'quest': 'здесь вопрос ', 'answers': (1, 2, 3, 4), 'right_answer': 4-1}
- #]
- def __init__(self,parent=None):
- QtWidgets.QWidget.__init__(self,parent)
- self.ui = Ui_MainWindow()
- self.ui.setupUi(self)
- Tlogic = Thread(target=Qlogic.start,args=(self))
- Tlogic.start();
- #@Tlogic.join()
- self.ui.pushButton.clicked.connect(self.MyFunction)
- def MyFunction(self):
- string = ''
- for question in self.d:
- string += question["quest"]
- self.ui.textEdit.setText(string)
- class Qlogic(object):
- answer = None
- d = [
- {'id': 1, 'quest': 'Вопрос 1 ', 'answers': ("Smile", "Smile", "Smile", "Smile"), 'right_answer': 2-1},
- {'id': 2, 'quest': 'Вопрос 2', 'answers': ("Smile", "Smile", "Smile", "Smile"), 'right_answer': 4-1}
- ]
- def start(self):
- string =''
- for question in Qlogic.d:
- string = question["quest"] +"\n" +question["answers"][0]+ "\n"+question["answers"][1]+"\n"+question["answers"][2]+"\n"+question["answers"][3]
- self.ui.textEdit.setText(string)
- while(Qlogic.answer == None):
- time.sleep(1)
- answer = None
- if __name__ == "__main__":
- app = QtWidgets.QApplication(sys.argv)
- myapp = MyWin()
- myapp.show()
- sys.exit(app.exec_())
- #Log
- #Exception in thread Thread-6:
- #Traceback (most recent call last):
- # File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 926, in _bootstrap_inner
- # self.run()
- # File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 870, in run
- # self._target(*self._args, **self._kwargs)
- #TypeError: start() argument after * must be an iterable, not MyWin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement