Create and delete buttons from script

17 views
Skip to first unread message

Fidel Pérez

unread,
May 24, 2013, 3:08:38 PM5/24/13
to leo-e...@googlegroups.com
Hi, been reading to figure out how to make and delete buttons from scripts.
So far I have this:

c.frame.getIconBarObject().add(text='hello button',command=c.executeScript)

I know Im close but still doesnt do what I need:

  • How to create button which executes the script of a node?
  • How to delete that button later on?

I have been reading quickmove.py to try to figure it out but its hard to understand yet :\

Thanks!

Terry Brown

unread,
May 24, 2013, 3:24:15 PM5/24/13
to leo-e...@googlegroups.com
On Fri, 24 May 2013 12:08:38 -0700 (PDT)
Fidel Pérez <fidel...@gmail.com> wrote:

> Hi, been reading to figure out how to make and delete buttons from scripts.
> So far I have this:
>
> c.frame.getIconBarObject().add(text='hello button',command=c.executeScript)
>
>
> I know Im close but still doesnt do what I need:
>
>
> - How to create button which executes the script of a node?
> - How to delete that button later on?
>
>
> I have been reading quickmove.py to try to figure it out but its hard to
> understand yet :\

Maybe look at

.../leo/plugins/leoPluginsRef.leo#Plugins-->Scripting-->@file
mod_scripting.py-->class scriptingController-->createAllButtons & helpers-->createScriptButtonIconButton 'script-button' & callback-->addScriptButtonCommand

Cheers -Terry

Matt Wilkie

unread,
May 25, 2013, 1:14:55 AM5/25/13
to leo-e...@googlegroups.com
> Maybe look at
>
> .../leo/plugins/leoPluginsRef.leo#Plugins-->Scripting-->@file
> mod_scripting.py-->class scriptingController-->createAllButtons & helpers-->createScriptButtonIconButton 'script-button' & callback-->addScriptButtonCommand

/me wishes for "leo://leoPluginsRef.leo#Plug....ommand"
:)

Fidel Pérez

unread,
May 25, 2013, 6:16:59 AM5/25/13
to leo-e...@googlegroups.com
Thanks for your answer, that solved it.
In case its useful for someone else, the code for button creation is:

g.app.gui.ScriptingControllerClass(c).handleAtButtonNode(p)
Reply all
Reply to author
Forward
0 new messages