<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 10, 2014 at 12:07 AM, iMath <span dir="ltr"><<a href="mailto:2281570025@qq.com" target="_blank">2281570025@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><span style="font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;font-size:14px;line-height:18px">I think the user interface shouldn't be freezed when using concurrent.futures.ThreadPoolExecutor here, but it doesn't meet my expectations,anyone can explain why ? any other solutions here to not let user interface freezed?<span style="line-height:0px">‍</span></span></div><div><span style="font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;font-size:14px;line-height:18px"><br></span></div><div><span style="font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;font-size:14px;line-height:18px">code is here</span></div><div><a href="http://stackoverflow.com/questions/27393533/user-interface-freezed-when-using-concurrent-futures-threadpoolexecutor" target="_blank">http://stackoverflow.com/questions/27393533/user-interface-freezed-when-using-concurrent-futures-threadpoolexecutor<span style="line-height:0px">‍</span></a></div><br>_______________________________________________<br>
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div><div class="gmail_extra">It appears: concurrent.futures.as_completed yields futures as they complete, so the main thread is blocked as it loops over this until all the futures have completed.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">You could use Qt's QNetworkAccessManager / QNetworkRequest, or perhaps you want something like scrapy if you're trying to crawl websites (could probably be integrated with a Qt app using qt4reactor)<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">What are you building?<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">- MH</div><div class="gmail_extra"><br></div></div>