event handler function for PyLbc

  • From: Alex Hall <mehgcap@xxxxxxxxx>
  • To: programmingblind <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 26 May 2011 21:20:05 -0400

Hi all,
I am trying to use PyLbc to make some dialogs. The problem is that I
cannot seem to get the event handler function to see any buttons I
create, only the default OK and Cancel buttons added by lbc. Below is
a simple test. Run it, and make sure to click all three buttons,
Cancel last. You will see that only Button_OK and Button_Cancel get
printed, not Button_test. My question is: why is this? If I could get
all buttons working I would not have a problem, since I could write
code for all the buttons in my dialogs, but I can do nothing if only
two default buttons are recognized.

Code:
import wx, lbc

def evt_handler(d, e):
 c=e.GetEventObject()
 print c.GetName()
 if e.GetEventType() in wx.EVT_CLOSE.evtType or c.GetName()=="Button_Cancel":
  d.Destroy()
 if c.GetName()==b.GetName():
  lbc.DialogShow("popup", "the button was clicked")

app=lbc.App()
dlg=lbc.Dialog(title="test")
b=dlg.AddButton(label="test")
dlg.ShowModal(handler=evt_handler)

-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: