Running external module and accessing the created objects
Kene.Meniru at illom.org
Sat Mar 9 18:39:46 CET 2013
Dave Angel wrote:
>>> So the solution I am looking for is to have a graphic window open that
>>> watches user.py for changes.
> It would then have to be a separate executable.
This is my thinking too.
> Are you really saying
> you want this window to keep "running" after the script ends? And that
> somehow it notices that the user has rerun the user.py script? Or
> could it simply be a window created during the user.py run that stays
> running till it's closed, which ends the script as well?
Following the idea that it should be a separate executable, the user does
not have to run the script by doing "python user.py" as they would normally
do. The window takes this over. It sits there watching for changes to
user.py such as change in file size and/or time or if the user hits the
enter key while it has focus.
My question really is how can the graphics window have access to the objects
saved in the dictionary of the doc object after running "python user.py". It
need to do this to be able to use their coordinates to redraw the view.
>>> If there is a change the graphic window
>>> updates the rendition of the created components without further
>>> intervention by the user.
> Is running the script considered intervention? Or do you mean literally
> that somebody watches the script for changes (eg. by watching the
I do not understand. What I mean is that this happens automatically. The
user no longer needs to do "python user.py" the graphics window now should
do this for the user when changes are detected in user.py by watching
timestamp for example.
>>> However this means that the graphic must
>>> somehow run python to parse user.py and then be able to access the
>>> objects stored in doc so that the coordinates can be used to update
>>> the view. This is where I am having difficulty.
> If you really want two processes, then you should consider having the
> user run the the graphic app, with a commandline parameter of user.py,
> and have it create the user.py process. The user.py process runs till
> it has created all the data, then sends it via some ipc to the graphic
> app. Once sent, it terminates. The graphic app reads the ipc stuff,
> updates its graphics, then idles, watching for timestamp changes on the
> user.py file.
This sounds interesting. What is ipc. Can you give me an example?
KeMeniru at gmail.com
More information about the Python-list