RE: event handler function for PyLbc

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 27 May 2011 07:55:25 -0400

I have not used lbc but wx passes events strangely you might have to bind
the event handler to the button.

ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall
Sent: Thursday, May 26, 2011 9:20 PM
To: programmingblind
Subject: event handler function for PyLbc

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

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: