Rachid Manseur wrote:
> Hello Andy:
>
> Thanks for your help. I have taken a fast look and will look in more
> details at the sample you suggest.
> With my level of python knowledge however, it feels like someone told me
> to look at a car because I
> asked a question about motors. I have no knowledge of data bases
> whatsoever so I am unable to
> even run the sample code. :)
> Is there any documentation or tutorial that you know about this topic?
> Thanks again.
>
> Rachid
>
>
>
[snip]
>
>
Not really a tutorial but if you look at the on_btnBrowse_mouseClick
method of the DbBrowser class in the dbBrowser.py module stored in the
samples/dbBrowser directory of your PythonCard installation you can see
the code I mentioned.
This takes the definition of the columns in a database table (provided
by the call to self._database.getColumns on line 106 and creates two
widgets for each one; one to show the contents and another as a label.
The code you are interested in is on lines 114 and 122 where the new
widgets are defined and then lines 118 and 127 where the widgets are
added to the current components. You should be able to take one pair of
these and copy them to your code to start experimenting, something like;
def on_something(self, event):
"Add a new widget to my background"
new_widget = {'type': 'StaticText',
'name': 'my_new_widget',
'position': (100, 100),
'text': 'Welcome to my new widget'}
self.components[new_widget['name']] = new_widget
Then link that command to something and you should be away.
Regards,
Andy
--
From the desk of Andrew J Todd esq - http://www.halfcooked.com/
|