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!
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()