On Sat, Sep 6, 2008 at 4:18 PM, Edward K. Ream <[EMAIL PROTECTED]> wrote:

>> Can I create buttons directly without relying on @button nodes, e.g. with 
>> something like:
>>
>> c.new_button('hello', my_callback)
>
> Of course.  You don't think the @button code does all the work itself, do you?

Ok, it was indeed as simple as doing:

def mkbutton(text, node_to_push):
    ib = c.frame.getIconBarObject()
    ib.add(text = text, command = node_to_push.ipush)

Some notes:

- Perhaps stuff like this could be abstracted away from gui classes to "leo API"
- "callback" would be more descriptive keyword arg name for arg() than
'command' (since passing a normal callable to it seems to be ok).

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to