For the diehard EG'rs

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
User avatar
kgschlosser
Site Admin
Posts: 3030
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

For the diehard EG'rs

Post by kgschlosser » Sun Nov 12, 2017 1:33 am

Ok so here I go again....

On more then one occasion it has been brought up if there is a way to run EG directly from a python interpreter. And the answer is Yes. I have discovered the way to do this. However it is not the simplest process because of the use of wx.App.MainLoop which causes the interpreter to get locked into a loop. So it will not exit.

But the jist of it is you have to make independent threads that you want to carry out whatever it is you want after wx.App.Mainloop runs. But you can set up specific callbacks and register them using eg.Bind and this can be done before the loop is run. So if you wanted to merge EG with specific tasks you can. And the GUI also still operates while it is running from the interpreter. This is my new preffered way of running EG. I have a console so I am able to execute commands and such as well as get logging output without all the "fluff". I am going to write up a nice little package that will simplify this process. But if you want the most basic of displays go to your EG install folder from a command prompt. And type in pyw.exe. this will launch an interpreter.

In that interpreter key in

Import eg

This will get eg part of the way there.

If you then do

eg.debugLevel = 1
eg.Main()

EG will run. And you will notice the debugging output being put into that console window. But you are not able to do anything else from there. So this is where I am going to make up a wrapper to give you functionality and be able to key in commands. And also have the events transferred to the console window.
If you like the work I have been doing then feel free to Image

User avatar
topix
Experienced User
Posts: 380
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: For the diehard EG'rs

Post by topix » Sun Nov 12, 2017 1:53 pm

What's the usecase for this?

User avatar
kgschlosser
Site Admin
Posts: 3030
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: For the diehard EG'rs

Post by kgschlosser » Sun Nov 12, 2017 9:43 pm

use case would be if you wanted to run EG without a GUI say.. On a Windows Core server. But still have log output and still be able to manipulate and add macros.
If you like the work I have been doing then feel free to Image

Post Reply