physimals / oxford_asl

A command line tool for quantification of perfusion from ASL data
Apache License 2.0
8 stars 7 forks source link

RF: Set initial choice selection after call to pack #21

Closed pauldmccarthy closed 1 year ago

pauldmccarthy commented 2 years ago

Hi @mcraig-ibme, I've come across some slightly strange behaviour under macOS Catalina / wxpython 4.1.1 with regard to the initial selection for wx.Choice widgets. This problem does not occur with wxpython 4.0.7.post2.

Basically, the initial selection for wx.Choice widgets is not being applied, as depicted below:

image

A little debugging led me to the widget.SetFont() call in theoxford_asl.gui.widgets:TabPage.pack function. Before this call, calling wx.Choice.GetSelection on the widget will return the initial selection value, but after the call will return -1.

This PR simply moves the inital call to choice.SetSelection(initial) after the call to self.pack, to work around this strange behaviour.

mcraig-ibme commented 1 year ago

Strange, but the suggested fix seems to be find on linux also so happy to apply