From: Alan W. I. <ir...@be...> - 2001-11-01 18:42:43
|
On Tue, 30 Oct 2001, Alan W. Irwin wrote: > Note, example1 is a modification of xw03.py. Ultimately, this > should not go into CVS. Instead, I will put my thinking cap on to figure out > how to make the required changes for all the xw??.py examples so they can be > run either as scripts (probably called from a main script) or from the GUI. To the plplot developers (and interested pyqt GUI developers): I have just figured out what changes have to be made to our xw16.py example to run it from the pyqt gui for plplot. I assume these changes will work for any of our xw??.py examples so that gives Allesandro a ton of examples to show off. (1) I have trimmed out everything until the line "def main():" The GUI only needs main() (or whatever you want to call it) defined and does not need all these preliminary imports. (2) Remove the plParseOpts, plinit and plend commands within main. The first is irrelevant, the second works, but bypasses the GUI, and the third makes it impossible to re-run the example from the GUI. With the above two changes, the modified xw16.py result looks good when displayed by the GUI with one exception. In the current primitive state of the GUI there is no page control so all the pages run through without stopping. I assume page control is something that Allesandro will want to address with high priority. BTW, all these pages are built and displayed so rapidly that you can just barely see them until the last one displays. This is a reflection of the building efficiency of Numeric and the display efficiency of pyqt and libqt. But don't take my word for it. See for yourself with any of our xw??.py examples (after you make the recommend changes to your local copies of xw??.py). ******************* I would now like to move on to a related issue: how to organize the python examples for the *non-GUI* case. What I am thinking of is making the above two changes for all the xw??.py examples, and renaming main in each case to the appropriate name of the example (x01, etc). Then I would create an overall examples script called pythondemos.py which does the preliminary required imports once (including all the examples), executes plParseOpts and plinit once, executes all examples as python modules, then executes plend. I also would do the necessary reconfiguration to make this new approach work smoothly. This python module approach would make our python examples much less cluttered for non-GUI testing. Also, it makes the examples much easier to work with for the current pyqt GUI case and potentially for a native Tkinter GUI case. Comments, please? Unless there are objections I plan to go ahead with this reorganization fairly soon. Alan |