Problems with wxChoice

I am hoping that someone out there can help me. I am trying to get the wxChoice control to behave under X-Win-32 5.40 when connected to a Red Hat Linux computer. When the choice control has a long list, the popup window extends below the screen with no scroll bars. It works perfectly under windows, but I can’t seem to find a way to get it to display in a usable manner on the X-Win. Below is code from the demo that has been slightly modified to show the problem.

Any ideas?

mike

from wxPython.wx import *

···

#---------------------------------------------------------------------------

class TestChoice(wxPanel):
def init(self, parent, log):
self.log = log
wxPanel.init(self, parent, -1)

#sampleList = [‘zero’, ‘one’, ‘two’, ‘three’, ‘four’, ‘five’,
# ‘six’, ‘seven’, ‘eight’]
sampleList = []
for item in range(100):
sampleList.append(str(item))

wxStaticText(self, -1, “This example uses the wxChoice control.”,
wxPoint(15, 10))

wxStaticText(self, -1, “Select one:”, wxPoint(15, 50), wxSize(75, 20))
self.ch = wxChoice(self, 40, (80, 50), choices = sampleList)
EVT_CHOICE(self, 40, self.EvtChoice)

def EvtChoice(self, event):
    self.log.WriteText('EvtChoice: %s\n' % event.GetString())
    self.ch.Append("A new item")

#---------------------------------------------------------------------------

def runTest(frame, nb, log):
win = TestChoice(nb, log)
return win

#---------------------------------------------------------------------------

Michael Verbeke wrote:

I am hoping that someone out there can help me. I am trying to get the wxChoice control to behave under X-Win-32 5.40 when connected to a Red Hat Linux computer. When the choice control has a long list, the popup window extends below the screen with no scroll bars. It works perfectly under windows, but I can't seem to find a way to get it to display in a usable manner on the X-Win. Below is code from the demo that has been slightly modified to show the problem.
Any ideas?

That's just the way the widget used for the wxChoice works. It is really only meant for a small number of choices. If you're going to have lots then you should use a wxComboBox instead, but it also has an effective limit of about 2000 items on wxGTK.

···

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