PyInstaller macOS issue: QCombobox not refreshing

Heads up! You've already completed this tutorial.

Mr_S_J_Childerley | 2020-10-15 08:21:47 UTC | #1

I am packaging a python script and I have the following code which correctly updates and selects the first index in one packaging environment, but doesn't in another. Unfortunately that environment where the code works as expected fails for some other obscure reason.

It's not the end of the world as on seeing a blank Combobox the user can make a selection, however it would be nice to have some code that worked correctly in all environments!

All wisdom/ideas/thoughts/inspiration gratefully accepted!

python
connections = SerialPorts()
ports = connections.available()
# clear & then populate combobox with ports,
# from which the client can choose.
self.pick_serial_ports.clear()
self.pick_serial_ports.addItems(ports)
self.pick_serial_ports.setCurrentIndex(0)
self.pick_serial_ports.update()

Mr_S_J_Childerley | 2020-10-15 07:43:18 UTC | #2

After rebuilding the environment from scratch I concluded that this issue is due to the unresponsiveness of Python Applications running in the distribution environment create by the PyInstallation process.

The issue of QCombobox (plus all other widgets) not being update is due to the GUI not redrawing itself. If the application is forced to redraw itself, perhaps by minimising and then selecting, the QCombobox is redrawn correctly. It's as if QApplication.exec isn't being permitted to process drawing events.

All wisdom/ideas/thoughts/inspiration gratefully accepted!


Steven_Hunt | 2020-11-04 11:27:32 UTC | #3

Sorry, I have no solution BUT want to check if my problem is the same as yours.

I'm VERY new to Python and coding but am working hard to get up to speed. I followed some PyQt5 tuts online and where text (labels, fields) and images (Pixmap within labels) need to update on events...they simply don't, until I click back on my IDE (PyCharm) window OR my system terminal. I’m running files in two environments (system and virtualenv) with same results.

I even tried samples that came with Martin's book and I am getting the same redraw issues, at least thats what I think it is as values do get passed on the event.

I'm running Python 3.9 on Mac Mojave 10.14.6


Mr_S_J_Childerley | 2020-11-17 14:32:14 UTC | #4

Hi Steve, sorry for the very tardy response. I hope you've fixed your issue now. I used Anaconda, mainly for legacy reasons, however when it works! it's very convenient. However it is quite heavy weight and frequently goes off into its own world!

I had two conda environments one which exhibited the issues I described and the other updated instantly.

My big problem now is that I've updated to "Big Sir" and now my Packaged environment no-longer renders Widgets at all! This is mission critical something I need to fix!


Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt5
Take a look

Downloadable ebook (PDF, ePub) & Complete Source code

Also available from Leanpub and Amazon Paperback

[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

PyInstaller macOS issue: QCombobox not refreshing was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.