From: Kevin A. <al...@se...> - 2007-03-26 15:46:40
|
On Mar 23, 2007, at 7:15 AM, Jaggo wrote: > Hello ! > > I'm trying to implement a GUI to a Python application I'm writing > using Python Card. > > [If anyone is interested, the application: > http://www.sourceforge.net/Gutenberg2pod/ > ] > > I've ran across a number of issues I failed to answer myself, the > biggest of which was: > > Regarding the component "list", I failed in attempting to create a > button which removed items from a list. I simply couldn't "guess" > the function which returned the index of items selected in a list. > Had this been Py-win I would have simply ran dir() on it, except > that I figure out what exactly was I dir-ing. > > Thank you for your responce, > Omer T. > All the component source files are in the PythonCard/components directory, so you could look at list.py in the case of the 'list' component. In addition, if you run your application with the shell, either via the -s or -d command-line option, you can inspect your components for attributes simply by using command completion in the shell. In your case, at the prompt you could type... >>> self.components.list1. and when you type the period (dot) you will see a list of attributes and methods. What you probably want is 'selection' and possibly 'stringSelection'. You can also look at all of the PythonCard samples and tools to see how things are done. In general, you will see a lot of methods that are in mixedCase style that are aliases for CamelCase wxPython methods (e.g. delete() is the same as Delete()), and for the most common get/set type of methods PythonCard provides an attribute like 'selection' that does the work of two methods such as GetSelection and SetSelection. Finally, in the PythonCard/samples/widgets/widgets.py sample there is a menu option under the File menu called 'Create Component Docs...' that will allow you to create a directory of HTML files with some simplistic documentation of your currently installed components. ka |