Re: event handler function for PyLbc

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 01 Jun 2011 10:07:40 -0400

Hi,
I am not understanding the example. You refer to more than one button but your code only creates a Test button.

The pyLbc.zip archive includes a fruit basket program with Add and Delete buttons, illustrating that other buttons can be defined. Also, the McTwit application has a main dialog with many buttons, based on pyLbc (though McTwit does not work with the current Twitter security scheme).

Hopefully I can help if I understand the problem better.

Jamal


On 5/26/2011 9:20 PM, Alex Hall wrote:
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)

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

Other related posts: