Friday 15 May 2015

python - PyQt : 'Async Function' Starter Function -



python - PyQt : 'Async Function' Starter Function -

first of all, don't know if i'm trying right way. want create function creates async functions.

from multiprocessing.dummy import pool pool = pool(processes=1) def asyncstarter(self,func): pool.apply_async( func, ) def looper(self): while < 100 : time.sleep(1) += 1 self.button.clicked.connect(lambda:self.asyncstarter('self.looper'))

to clear, i'm not experienced programmer, looked @ pyqt's qthreads hard me understand.

anyway, possible utilize variable within apply_sync ? seen in code, "func" sent depending on button clicked.

i don't know if it's best 1 found solution myself (although looks ridicilous) ;

def asyncstarter(self,func): command = "pool.apply_async(%s)" %func eval(command) start = command

python variables asynchronous pyqt

No comments:

Post a Comment