Hi,When I previously tried running your sample, it immediately crashed -- no dialog came up. I may have been using a different lbc.py. Where did you get the one you are using? Perhaps put your sample program and your lbc.py in a zip file and attach it in a direct message to me.
JamalOn Thu, 16 Jun 2011, Alex Hall wrote:
Date: Thu, 16 Jun 2011 14:26:51 -0400 From: Alex Hall <mehgcap@xxxxxxxxx> To: Jamal Mazrui <empower@xxxxxxxxx> Cc: programmingblind@xxxxxxxxxxxxx Subject: Re: event handler function for PyLbc I usually don't persist in asking a question if no one answers, but I now have two applications that I would very much like to continue writing. Both use a gui and I would very much like to use lbc in them, but if I cannot get the event handler to work, then I will not be able to use lbc. So... any ideas on why the event handler would not print the name of any buttons except OK and Cancel? This is, I think, the core of my problem. Here again is the example I am using as a basic test. Run it and hit enter on all three buttons. Instead of printing the name of each, you will find that only button_OK and button_Cancel are printed, never button_test. 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(buttons=['OK', 'Cancel'], handler=evt_handler) On 6/1/11, Alex Hall <mehgcap@xxxxxxxxx> wrote:The line b=dlg.AddButton(label="test") 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: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)-- Have a great day, Alex (msg sent from GMail website) mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap-- 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