In a message dated 8/11/2009 11:30:51 P.M. Eastern Daylight Time,  
[email protected] writes:

[email protected] wrote:
> I played around with the  dlg.show() line, and I think the behavior  was 
> because in the  original, the extra show was redundant. Somehow, the 
"self"  
>  parameter in 
>  
>  dabo.ui.createForm("findRun3.cdxml",  self)
> 
> 
>  caused the show to be true, and so the next line was redundant.  Doesn't 
 
> seem to matter what the third (parent) parameter is.

You are  right, self would have evaluated to a boolean True, so what was 
happening  was the dialog was being shown after being created, and then 
your show()  line was being called again, and then the dialog was being  
released.

> BTW, we've been trying to figure how to use  functions based on the  way 
> they are presented in the API  documentation. I'm a bit confused. When 
the  docs 
> say, for  example, 
>  
> createForm(srcFile, show=False, *args,  **kwargs)
>  
> looks like the show parameter can be passed  either as "True" or as  
> "show=True".

Correct. Python has  positional and keyword arguments, and either can 
have default values. The  act of giving a default value makes it have 
both positional and keyword  argument behavior.

So, show is the second argument (argument number 1,  given python's 
zero-based indexing). If you don't pass a second argument,  show will get 
the default value of False.

> and how would we  know from the documentation, that a third  parameter 
could 
> be  "parent=self"?

You wouldn't. This createForm() function simply passes  any additional 
positional (*args) and keyword (**args) arguments up to the  constructor 
of the class, which accepts all kinds of arguments depending  on the 
class in question.

So, you'd have to know that the dialog  class (and all dabo ui classes) 
accept a parent argument. Once you've used  Dabo for a while, you know 
this implicitly.

The confusing thing  here is that the parent arg is in the second 
position in all dabo ui  classes, but in the third position for the 
createForm()  function.


> (and is that an "*arg" or a "**kwarg"?)

*  sends a tuple of positional arguments, and ** sends a dict of keyword  
arguments.

Paul




Thanks, this is great information.
Jonathan






--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to