From: Noel O'B. <bao...@gm...> - 2009-10-06 13:01:34
|
2009/10/6 Marcus D. Hanwell <ma...@cr...>: > Noel O'Boyle wrote: >> 2009/10/6 Karol M. Langner <kar...@gm...>: >> >>> On Tuesday 06 October 2009 13:25:46 Geoffrey Hutchison wrote: >>> >>>> On Oct 6, 2009, at 7:04 AM, Noel O'Boyle wrote: >>>> >>>>> Is it possible to control Avogadro from a >>>>> Python script running at the Windows command prompt >>>>> >>>> It's possible to embed Avogadro in a Python script. But no, at the >>>> moment, Avogadro does not accept "signals" or external commands from >>>> other processes. I'm not even sure if that would be secure. >>>> >>>> Cheers, >>>> -Geoff >>>> >>> Maybe it's worthwhile to think about. That would be so useful... >>> >> >> >From a user's perspective, there are two ways to go. Either "import >> avogadro; avogadro.startgui(); avogadro.display(myOBMol)" or as am >> currently doing with pymol (you need to start it with the -R option) >> "import xmlrpclib; s = xmlrpclib.Server("http://localhost:9123"); >> s.loadfile("myfile")" >> >> - Noel >> > I think that the first approach is the one which works now (or did). > This is also the approach used in applications with similar Python > bindings such as VTK and ParaView. You use the embedded interpreter to > manipulate the application, or start a new instance from a shell. Is there any working example of this? This would solve my problem. > The second approach would be interesting, but would need some work to > set up a server. Are there many use cases not satisfied by starting a > new instance of Avogadro from a shell (or more likely, the GLWidget), > and if users want the full application too then use the embedded > interpreter? I don't need this, but it would provide a way to interface with Avogadro from other languages, e.g. Java. > Marcus > |