|
From: Kevin A. <al...@se...> - 2001-10-18 18:50:51
|
PythonCard supports the following runtime tools (command-line switch in parens). Log (-l) Message Watcher (-m) Namespace Viewer (-n) Property Editor (-p) Shell (-s) The Log facility is defined in log.py. The other runtime tools or their wrappers are in debug.py. All of the runtime tool windows are children of the parent app window, so they don't show up on the taskbar. In addition, if one of the windows is created at startup, then all of the tools are initialized and available via the Debug menu, otherwise they are not initialized or available and apps don't incur any startup or memory overhead from the runtime tools. All of the runtime windows are done in raw wxPython and their events will not interfere or show up in the main app event loop. It would be preferable for the windows to be defined just like other PythonCard backgrounds/windows, to simplify controlling them from a PythonCard app and to help with their longer-term maintenance. The runtime tool window positions, sizes, and whether they are shown by default is defined in the pythoncard.config.py file or the pythoncard.user.config.py file if you've saved the settings from the Debug menu. You can redirect stdout (print statements) to the shell and back to the console at any time while an app is running. The Namespace Viewer and Shell are provided by PyCrust and not part of the PythonCard framework. The Namespace Viewer shows the local application namespace. I'll let Patrick go into more detail if he has the time. The Message Watcher shows all of the events generated and handled by widgets in PythonCard. Unused events are shown in parens (). Idle events are not currently generated by the framework, so they are not shown. The Property Editor allows editing of widget attributes (properties). Only those attributes that are read-only can't be changed and usually that is because the attribute can only be set during initialization. The Property Editor is the key part of the resourceEditor sample. The Shell is an application in itself, so again I think I'll let Patrick chime in here if he wants. With a basic application defined, you can then do just about anything you want from the shell. The shell automatically load a series of commands such as: >>> bg = pcapp.getCurrentBackground() >>> comp = bg.components by placing the commands in a pycrustrc.py file in the app directory (see the turtle sample). There have been numerous messages on the list showing how to add and interact with widgets at runtime. You can also define methods at runtime, which is shown here: http://aspn.activestate.com/ASPN/Mail/Message/770015 The Shell supports command-completion and tool tips, so it is very nice for interactive programming, learning and testing PythonCard. Again, the turtle sample is a good example of using the shell. Since the shell is provided via PyCrust, most of these features aren't limited to just PythonCard, but PythonCard probably makes the most and best use of PyCrust right now. ka |