Hi Sean,

The pymol syntax for getting help on a command is "help command". I
think it is a wrapper around the python help function, for which the
syntax is "help(command)". In your case, it would only show something
like:

test(*args,**kwargs)

You can write a docstring, e.g. similar to the ones in
modules/pymol/cmd.py in the pymol directory, to have more help with
your function. There you can also write the syntax and the function
arguments. These can not be inferred from the argument list itself,
since you use *args and **kwargs there. In case you want 'test ?' to
give help, you have to add a conditional to your function, e.g.:

if "?" in args:
  print helptext
  return

Hope it helps,

Tsjerk
On Thu, Jun 14, 2012 at 6:00 PM, Sean Law <magic...@hotmail.com> wrote:
> Hi PyMOL Community,
>
> I have a PyMOL script that I have written that starts with the following
> kind of format:
>
> -----------------
> from pymol import cmd
> from re import *
>
> def test (*args, **kwargs):
>
>   var1=0
>   sel=""
>
>   for key in kwargs:
>     if (key == "var1"):
>       var1=int(kwargs["var1"])
>     elif (key == "selection"):
>       sel=kwargs["selection"]
>     else:
>       continue
>
>   while (len(args)>=1):
>     args.pop(0)
>
>   return
> cmd.extend("test", test)
>
> ----------------------
>
>
> I've noticed that in this format the usage output (i.e. if I do "test ?")
> does not contain any valuable information:
>
> test ?
> Usage: test
>
> Thus, I was hoping that there was an easy way that I can directly specify
> what the Usage output says.  I was hoping that it would say something like:
>
> Usage: test [var1=0 [, selection=""]]
>
> Any suggestions would be greatly appreciated.  Thanks.
>
> Sean
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to