The convenience function wx.GetSingleChoiceIndex works as advertised for presenting a list of choices and returning an index, but I cannot get it to honor the width= and height= parameters.
The other GetChoice style windows have same behavior.
Bug or user error?
Simple example run on MS-Windows:
import wx
class TestFrame(wx.Frame):
def __init__(self):
self.choices = ['zeroth one','first one', 'second one', 'third one',
'fourth one', 'fifth one', 'sixth one']
super(TestFrame, self).__init__(None)
ver = wx.StaticText(self, -1, 'wx version: '+wx.version())
btn1 = wx.Button(self, label="use default size")
btn2 = wx.Button(self, label="use my size")
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(ver,0,wx.ALL,8)
sizer.Add(btn1,0,wx.ALL|wx.EXPAND,8)
sizer.Add(btn2,0,wx.ALL|wx.EXPAND,8)
self.SetSizerAndFit(sizer)
self.Layout()
self.Bind(wx.EVT_BUTTON, self.dotest1, btn1)
self.Bind(wx.EVT_BUTTON, self.dotest2, btn2)
def dotest1(self, evt):
answer = wx.GetSingleChoiceIndex('message', 'caption',
self.choices, self)
print 'default size answer is:',answer, \
answer!=-1 and self.choices[answer] or ''
def dotest2(self, evt):
answer = wx.GetSingleChoiceIndex('message', 'caption',
self.choices, self, width=400, height=400)
print 'my size answer is:',answer, \
answer!=-1 and self.choices[answer] or ''
app = wx.PySimpleApp()
frame = TestFrame()
frame.Show()
app.MainLoop()