[Idle-dev] Embed question: opening IDLE from another application
alin.moldoveanu at rdslink.ro
Wed Jun 8 19:36:12 CEST 2005
Here is what I need:
- from an external program to open a .py file in IDLE and go
automatically to a certain function
- if the file is already opened in IDLE it shouldn't be reopened, just a
jump to the function is required.
- the external program can open several files or functions in this way
- after a file is opened, the application should continue it's normal
Note: Jumping to the function is not an issue, the problem is with starting
IDLE in a correct way.
I tried to open a file in Idle with:
// the arguments (the name of the file to be opened) are passed using
PyRun_SimpleString ("import idlelib.PyShell\n");
The problem is:
- when I start IDLE, the calling code from my application is blocked
until these calls return (only then x is reached). Of course, this is quite
- I tried to move these calls on a separate thread. The main thread of
the application doesn't block anymore, but a second call to the 2 methods
above (while the Idle opened by the first call is opened) will cause a crash
I'm quite new to Python and I'm sure there should be some simple way to do
what I need.
I hope I didn't bother you with such a long post.
Thanks for any help or suggestion.
More information about the IDLE-dev