current position:Home>Can I access UI components in Python multi process?

Can I access UI components in Python multi process?

2022-02-02 21:46:56 CSDN Q & A

I tried to access... In the process pool UI Component to modify , Like this ,ui Is the object created . The error information is below . The process pool can access UI Components ?

        func = partial(self.to_main, ui)        with ProcessPool(processes= 8) as pool:            res = pool.map(func, path_list)
  File "E:\PycharmProjects\test.py", line 30, in tomain    res = pool.map(func, DB_path_list)  File "D:\Program Files (x86)\Python\Python37\lib\multiprocessing\pool.py", line 268, in map    return self._map_async(func, iterable, mapstar, chunksize).get()  File "D:\Program Files (x86)\Python\Python37\lib\multiprocessing\pool.py", line 657, in get    raise self._value  File "D:\Program Files (x86)\Python\Python37\lib\multiprocessing\pool.py", line 431, in _handle_tasks    put(task)  File "D:\Program Files (x86)\Python\Python37\lib\multiprocessing\connection.py", line 206, in send    self._send_bytes(_ForkingPickler.dumps(obj))  File "D:\Program Files (x86)\Python\Python37\lib\multiprocessing\reduction.py", line 51, in dumps    cls(buf, protocol).dump(obj)TypeError: can't pickle mywindow objectsBackend TkAgg is interactive backend. Turning interactive mode on.



Refer to the answer 1:

Multithreaded access UI You need to use delegation
I don't know if multiple processes work




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022146544285.html

Random recommended