GetSingleChoice sizing

Hello,

I was hoping to use a wx.GetSingleChoice – or in this case, more specifically, a wx.GetSingleChoiceIndex dialog to allow a user to choose between two possibilities within a modal frame.

The control works perfectly, with one exception: it seems to be ignoring the size arguments I pass. Thus it really isn’t looking the way I want it to. I get a box with room enough for about 12 lines of text, and in it is displayed my two lines with two choices. This widget is perfect for my purpose, but is there currently a way to make it honor its size parameter?

My setup: Python 2.5.1, wxPython 2.8.4.0 (msw-Unicode). Windows XP Professional.

Example:

action = wx.GetSingleChoiceIndex( ‘prompt string’, ‘frame caption’, [‘option 1’, ‘option 2’], height=40)

Thanks in advance for any observations on this.
Eric

Additional info upon further reading:

…Apparently the wx.SingleChoiceDialog class itself does not have width or height arguments. It seems likely that wx.GetSingleChoice and its other variations like GetSingleChoiceIndex use a SingleChoiceDialog. Therefore it seems likely that the presence of width and height arguments in the constructor function for GetSingleChoice and GetSingleChoiceIndex might have been in error.

True?

···

On 6/18/07, Eric Ongerth ericongerth@gmail.com wrote:

Hello,

I was hoping to use a wx.GetSingleChoice – or in this case, more specifically, a wx.GetSingleChoiceIndex dialog to allow a user to choose between two possibilities within a modal frame.

The control works perfectly, with one exception: it seems to be ignoring the size arguments I pass. Thus it really isn’t looking the way I want it to. I get a box with room enough for about 12 lines of text, and in it is displayed my two lines with two choices. This widget is perfect for my purpose, but is there currently a way to make it honor its size parameter?

My setup: Python 2.5.1, wxPython 2.8.4.0 (msw-Unicode). Windows XP Professional.

Example:

action = wx.GetSingleChoiceIndex( ‘prompt string’, ‘frame caption’, [‘option 1’, ‘option 2’], height=40)

Thanks in advance for any observations on this.
Eric

Eric Ongerth wrote:

Additional info upon further reading:

...Apparently the wx.SingleChoiceDialog class itself does not have width or height arguments. It seems likely that wx.GetSingleChoice and its other variations like GetSingleChoiceIndex use a SingleChoiceDialog. Therefore it seems likely that the presence of width and height arguments in the constructor function for GetSingleChoice and GetSingleChoiceIndex might have been in error.

True?

Or more likely they are there for legacy compatibility reasons after the common dialog code was refactored.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Okay. Is there any way to get wx.SingleChoiceDialog to appear at the size I want, or should I subclass wx.Dialog instead? Due to the fact that I was hoping to use wx.GetSingleChoiceIndex to keep the code for this minor dialog short and to-the-point, there would be no place to call SetSize() on the dialog since it’s all in a function call and the size arguments are placebos.

I thought of abandoning the wish to use the functional GetSingleChoiceIndex() form and just creating a wx.SingleChoiceDialog (whose constructor does not accept size arguments), then calling SetSize on the dialog after creating it, which should resolve up to its method SetSize() inherited from its ancestor class wx.Window. But setting its size then calling its Layout() method had no effect either.

Should I post a test case?

···

On 6/19/07, Robin Dunn robin@alldunn.com wrote:

Eric Ongerth wrote:

…Apparently the wx.SingleChoiceDialog class itself does not have width
or height arguments. It seems likely that wx.GetSingleChoice and its
other variations like GetSingleChoiceIndex use a SingleChoiceDialog.

Therefore it seems likely that the presence of width and height
arguments in the constructor function for GetSingleChoice and
GetSingleChoiceIndex might have been in error.

True?

Or more likely they are there for legacy compatibility reasons after the
common dialog code was refactored.

Eric Ongerth wrote:

I thought of abandoning the wish to use the functional GetSingleChoiceIndex() form and just creating a wx.SingleChoiceDialog (whose constructor does not accept size arguments), then calling SetSize on the dialog after creating it, which should resolve up to its method SetSize() inherited from its ancestor class wx.Window. But setting its size then calling its Layout() method had no effect either.

Just calling SetSize should be enough.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Good. Thank you. I’ll give it another go.

···

On 6/19/07, Robin Dunn robin@alldunn.com wrote:

Just calling SetSize should be enough.