On Sunday, April 19, 2020 at 4:11:41 PM UTC-4, tfer wrote:
>
> Okay, I've made some progress. Turns out, I was erroneously assumed I was
> in an IPython shell because it had 'magics', but it was just the idle
> interpreter, (never spent much time in Idle). All it took was creating a
> new shell config, and ticking the IPython box.
>
> I'm going paste in some of the shell interaction with comments
> interspersed and a question.
> [snip]
>
> In [4]: g.commander_command('new') # naive attempt open a new file in Leo
>
> ---------------------------------------------------------------------------
>
> NameError Traceback (most recent call
> last)
>
> <ipython-input-4-c784551296f6> in <module>
>
> ----> 1 g.commander_command('new')
>
>
> NameError: name 'g' is not defined
>
> /*
> Hmm, 'g' is not availible, let's try a fully qualified name, reaching down
> from the 'leo' we saw from In [3]: whos :
> */
>
> In [5]: leo.commands.commanderFileCommands.new() # so here is my
> question,what should I use for my argument?
>
> ---------------------------------------------------------------------------
>
> TypeError Traceback (most recent call
> last)
>
> <ipython-input-5-0f3e5c284e86> in <module>
>
> ----> 1 leo.commands.commanderFileCommands.new()
>
>
> TypeError: new() missing 1 required positional argument: 'self'
>
>
> In [6]:
>
> The question is at In [5] above, I guess it would be 'g.app', but 'g'
> isn't available, any suggestions?
>
> Doing things like this is the reason I first started looking at IPython,
> to provide a way to explore Leo code.
>
When I run command [4] in the Python console tab inside Leo (not the Pyzo
shell), I get this:
>>> g.commander_command('new')
<leo.core.leoGlobals.CommanderCommand object at 0x000001FDACBE36D0>
And also in the console tab:
>>> import leo
>>> help(leo.commands.commanderFileCommands.new)
Help on function new in module leo.commands.commanderFileCommands:
new(self, event=None, gui=None)
Create a new Leo window.
I'm not sure what object is needed for self...
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/c53e3748-6ec9-496f-a431-9c27247867a9%40googlegroups.com.