Binding two event to two COMBOBOX

Hi,
I hava two combobox cb1 et cb2.I want to assgin to those combobox two
different event.when i select an item from cb1 print x will be
executed .But when i select an item from cb2 a print y will be
executed.My problem is for all the items of cb1 and cb2.allaways print
x is excuted. :\
this is my code:
import wx
class maissa(wx.Frame):
  path1="path"
  MyList = []
  liste7=[]
  liste_glob=[]
  l2 = []
  listef_2=[]
  liste_chemin2=[]
  liste_glob_tache=[]
  liste_parent=['aa','bb']
  liste_fils=["www"]
  liste_inter=[]
  max=0
  priorite=[]
  listeb=['a','b','c']
  def __init__(self,parent,id):
    wx.Frame.__init__(self,parent,id,"OSB",size=(400,400))
    panel=wx.Panel(self)
    # self.cb = wx.ComboBox(panel, 500, "Les taches", (20, 60), (161,
21), maissa.MyList,wx.CB_DROPDOWN)#| wx.TE_PROCESS_ENTER| wx.CB_SORT)
    self.cb1 = wx.ComboBox(panel, 500, "Parents", (60, 60), (161, 20),
maissa.liste_parent,wx.CB_DROPDOWN)#| wx.TE_PROCESS_ENTER| wx.CB_SORT)
    self.cb2 = wx.ComboBox(panel, 500, "Fils", (248, 60), (141, 20),
maissa.liste_fils,wx.CB_DROPDOWN)#| wx.TE_PROCESS_ENTER| wx.CB_SORT)
    self.cb1.Show(True)
    self.Bind(wx.EVT_COMBOBOX, self.OnSelect,self.cb1)
    self.Bind(wx.EVT_COMBOBOX, self.OnSelect2,self.cb2)
    self.cb2.InsertItems(maissa.liste_fils,0)
    self.cb2.Show(True)
  def OnSelect(self, event):
    self.item = event.GetSelection()
    print 'y'
  def OnSelect2(self,event):
    print "x"
    self.item = event.GetSelection()
    # print ">>",self.item
if __name__=='__main__':
  app=wx.PySimpleApp()
  frame=maissa(parent=None,id=-1)
  frame.Show()
  app.MainLoop()

Some one could help...???

You are using the same ID for each widget. Give them different IDs, or use wx.ID_ANY (-1) to tell the widget to create its own unique ID.

···

On 5/6/11 11:14 AM, ab wrote:

Hi,
I hava two combobox cb1 et cb2.I want to assgin to those combobox two
different event.when i select an item from cb1 print x will be
executed .But when i select an item from cb2 a print y will be
executed.My problem is for all the items of cb1 and cb2.allaways print
x is excuted. :\
this is my code:

    self.cb1 = wx.ComboBox(panel, 500, "Parents", (60, 60), (161, 20),
maissa.liste_parent,wx.CB_DROPDOWN)#| wx.TE_PROCESS_ENTER| wx.CB_SORT)
    self.cb2 = wx.ComboBox(panel, 500, "Fils", (248, 60), (141, 20),
maissa.liste_fils,wx.CB_DROPDOWN)#| wx.TE_PROCESS_ENTER| wx.CB_SORT)

--
Robin Dunn
Software Craftsman