Re: Beginner Help

Kevin Altis <[email protected]>
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
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


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.