On Thu, 21 Dec 2017 21:22:36 -0800 (PST)
tscv11 <tsc.v...@gmail.com> wrote:

> Wow, there's some neat stuff in there, thanks! However, If I'm not
> mistaken, no values are passed outside the class definition. Perhaps
> there's no way to do that. Or did I just miss it?

callback_B creates nodes which persist after the widget closes.

If you need to pass things outside of the object, you can glue them to
c.  Best really to use just one item, a dict, so

c.__my_stuff = {...}

rather than

c.__my_this = 7
c.__my_that = 'seven'

But you may not need to pass things out of the object - if you can do
whatever you need to do in callback_B, you're done.  The class can have
as many functions as you need, which can be called from the callback,
so there's no limit to how much work can be done in a callback.

Actually the last part should have been:

@g.command('get-db-stuff')
def get_db_stuff(event):
    c = event.get('c')  # get the c that was active when the command was called
    gds = GetDBStuff(c=c)
    gds.show()
    # without this persistant reference gds gets garbage collected
    c.__gds = gds

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to