On Thursday 03 January 2008 12:22:25 am Alan Gauld wrote:
> Are you sure you made it a modal dialog?
> Any dialog will do that if it is opened modelessly, you need to
> use the modal version to make it block the app.

Yes.  I believe the way I have coded the dialog causes a bug.  If I create a 
static dialog and use showModal() it works as expected.
>
> Putting the class code in a functiion is legal but very inefficient
> and also prevents you from storing state etc in the dialog - you
> would need to reinitialise all valuues on each use. Thats OK if
> its simple but a lot of work(and slow)  if its complex.

I am creating a function that does a lookup of PK or FK fields.  If the user 
does type in the correct identifier then the dialog does not appear and is 
not created.  If the user types in a partial of the key then the dialog 
appears and the user picks from the list.  The details of the dialog are 
dynamic for each call (based on some meta data) of the showModal(). 

So I started thinking why would I need the class outside of the function.  If 
I instead used "import class" would I get a performance improvement?  The 
function creates an instance each time it is required and then releases and 
closes.  

I am very interested in this possible difference between importing the class 
vs using the inline class.  Any thoughts as what the difference is will help 
me understand Python a little better.

-- 
John Fabiani
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to