From: Andy T. <an...@ha...> - 2005-01-24 10:20:19
|
Dr. Brooks wrote: > Mr. Todd > Thank you for your interest . > While preparing an email in reply to your request for more information > I launched the PythonCard script from the Pythonwin 2.3.2 interface > and the PythonVideo image window opened. I have since changed my > default python launching program to Pythonw (from python 2.3.4) and > all works well. > > However I do have another question. > What I am trying to do is have a user interface to a modified > Evolutions ER1 robot. This interface accepts voice input from Dragon > Speak NatLink and opens a TCP IP socket and RS232 Com port to my > robot. It also allows to user to issue commands to the robot's > Behavior program (a python script). I would like to have the robot's > behavior program run and send and receive input from the user > interface. Unfortunately I do not understand the method by which the > PythonCard GUI communications with other modules. Can I have my my > behavior program run and communicate with the TextArea of the GUI? > Can the Behavior Module Call elements of the GUI ? > It seems that the GUI runs in a loop and thus prevents the Behavior > Module from executing in parallel. A pointer to an example or > tutorial would be greatly appreciated. > > Again Thank for Your Interest > > On Mon, 03 Jan 2005 11:06:35 +1100, Andy Todd <an...@ha...> wrote: [snip] >> The answer is a qualified 'depends'. Yes, PythonCard (well, actually wxPython) executes in a loop and is essentially the controlling process whenever it runs. What you can do, though is import your behaviour program and call it from your PythonCard application, e.g. import myProgram class MyApp(model.background): def on_<component>_<event name>(self, event): myProgram.do_something() etc ... Where it may be troublesome is if your application is asynchronous. This means that you ask it to do something and then have to keep checking if it has finished. If that is the case then the documentation on Timers and Threads may be useful to you; http://pythoncard.sourceforge.net/timers-threads.html If any of your calls are synchronous (i.e. return control to PythonCard when they have finished) then writing the program is easier. Just included in your PythonCard program anything that you would normally type at the Python prompt. I've cc'ed this message to the PythonCard users list as you will always get good feedback from the good people there. They will generally be more prompt in answering your questions, as you can see I get round to my email in fits and starts and your chances of a useful and timely reply increase with the number of people who see it. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |