Re: How prevent wxglade overwriting button handler
Dietmar Schwertberger <[email protected]>
| Newsgroups | gmane.comp.python.wxglade |
|---|---|
| Message-ID | <[email protected]> |
On 6/19/17 1:36 PM, Brendan Simon (eTRIX) wrote:
> I don't understand why I have to deactivate "Overwrite existing
> sources". That doesn't make sense to me. I've added some extra
> widgets to the design and now I want to regenerate sources, so I need
> to overwrite them.
If you interpret this option that way, then it would not be too useful
as only the first time any code would be written.
I think, the label should be changed to something like "Overwrite user
code" together with some better tooltip help, though.
> I ended up sub-classing the app and binding the widgets, as I have
> asyncio coroutines working at that level that need to interact with
> the gui.
>
> Still wxglade is generates the print statement that outputs to stdio,
> whether you want it or not. If it is commented out or deleted, it
> gets regenerated on the next regeneration of the sources.
This way, you have two handlers, both bound to the event and therefore
also both are executed:
- generated by wxGlade in the generated class and bound by the
generated class
- written and bound by you in your application
So either don't define a handler in wxGlade or override the generated
handler in a derived class.
Probably I should have written in my last message:
class ExampleFrame(ExampleGUI.ExampleFrame):
def __init__(self, app):
self.app = app
ExampleGUI.ExampleFrame.__init__(self, None, wx.ID_ANY, "")
# XXX override generated handlers here
def on_button(self, event):
#print("Event handler 'on_button' not implemented!")
self.app.do_something_useful()
event.Skip()
Regards,
Dietmar
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
wxGlade-general mailing list
wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/wxglade-general