wx.Choice fails to connect events on linux but works on win

10 views
Skip to first unread message

Martin Puttke

unread,
Nov 6, 2015, 11:24:09 AM11/6/15
to wxpytho...@googlegroups.com
hi folks,
in the following code, the EVT_LEFT_DOWN and EVT_ENTER_WINDOW events are
not triggered in my wxPython 3.0.2 home built on ubuntu, but it works as
expected on win or on other controls (like textctrl), or when i use an
older wxPython version.

Any suggestions how to solve this?

test.py:

import wx

class MainWindow(wx.Frame):
'''test frame'''
def __init__(self,*args,**kwargs):
'''Constructor'''
super(MainWindow,self).__init__(*args,**kwargs)
self.panel = wx.Panel(self)

sizer = wx.BoxSizer(wx.VERTICAL)

text = wx.StaticText(self.panel, wx.ID_ANY, "hallo")
sizer.Add(text, 0, wx.ALL, 5)

choice = wx.Choice(self.panel)
choice.Append("nasowas")
choice.Append("gibtsdas")
sizer.Add(choice, 0, wx.ALL, 5)

choice.Bind(wx.EVT_CHOICE, self.OnChoice)
choice.Bind(wx.EVT_LEFT_DOWN, self.OnChoice)
choice.Bind(wx.EVT_ENTER_WINDOW, self.OnChoice)

self.panel.SetSizer(sizer)

def OnChoice(self, event):
print "here"
event.Skip()


if __name__ == '__main__':
app = wx.App()
frame = MainWindow(None, -1, 'test window')
frame.Show()
app.MainLoop()
Reply all
Reply to author
Forward
0 new messages