[PyQt] question about dip models and dip io
dsdale24 at gmail.com
Thu Aug 5 16:49:23 BST 2010
On Thu, Aug 5, 2010 at 10:59 AM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Thu, 5 Aug 2010 10:13:27 -0400, Darren Dale <dsdale24 at gmail.com> wrote:
>> Is there any documentation available on dynamically creating a new model
> You do it just like you would for any other Python type by calling its
> from dip.model import MetaModel, Model, Int
> my_dynamic_type = MetaModel('MyDynamicType', (Model, ),
> my_instance = my_dynamic_type(my_int_attr=10)
> # This will raise an exception...
> my_instance.my_int_attr = 'bad'
> You will have to use the current dip snapshot as I hadn't exposed
> MetaModel as part of the dip.model in v0.1.
Great, thank you!
More information about the PyQt