Re: event handler function for PyLbc

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 16 Jun 2011 23:39:08 -0400

A simple fix is to create the Test button by specifying its name in the array that includes the OK and Cancel buttons. That would put it on the same row of buttons, however, which is unconventional.

Your issue motivated me to revise the Layout by Code module to take advantage of subsequent improvements I made to it when developing McTwit. In a separate message, I will post information about the new version of the module. Let me know if yu have further questions after trying that out.


On 6/1/2011 11:42 AM, Alex Hall wrote:
The line
creates a button in the variable named "b". I refer to this in my
function. The event handler should be able to use that. The bigger
problem, though, is that my event handler is supposed to print the
result of GetName() on all controls, but it only works on any default
OK and Cancel buttons created by ShowModal(). If you run it and press
enter on the test button, nothing is printed. Click the Cancel button,
though, and that button's name gets printed. This leads me to believe
that the event handler is, for some reason, not seeing my button at
all. I have been through the fruit basket demo many times, and I
thought I was following its model, using GetName() to get the control
name and then comparing and finding the control from there. Is there
something I am missing that would clear all this up? Thanks.

On 6/1/11, Jamal Mazrui<empower@xxxxxxxxx>  wrote:
I am not understanding the example.  You refer to more than one button
but your code only creates a Test button.

The 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

Hopefully I can help if I understand the problem better.


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.

import wx, lbc

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


View the list's information and change your settings at

Other related posts: