wxPython question: wxChoice object wrongheaded?

Riaan Booysen riaan at e.co.za
Thu Mar 9 15:07:55 EST 2000
Steve Holden wrote:

> I tried creating a wxChoice (Windows drop-down) object assuming that
> size and position would be optional arguments, and was surprised to
> see:
> 
> Traceback (innermost last):
>   [yada yada yada]
>   File "TaskRecord.py", line 43, in MakeBox
>     self.PrjChoice = wxChoice(self, PROJECT, ProjectList)
>   File "c:\program files\python\wxPython\controls.py", line 167, in __init__
>     self.this = apply(controlsc.new_wxChoice,_args,_kwargs)
> TypeError: Expected a 2-tuple of integers or a wxPoint object.
> 
> When I change the offending line 43 to
> 
>     self.PrjChoice = wxChoice(self, PROJECT,
>                               wxPoint(0,20), wxSize(-1,-1), ProjectList)
> 
> the program runs correctly.  The position and size don't actually seem to
> be actioned.  In the C++ documentation the pos and size parameters are
> also required.  Anyone explain the logic here, or is this a feature?

Actually the pos and size parameters are not required if you're satisfied 
with default values.
To only specify the list you have to use a keyword argument:

     self.PrjChoice = wxChoice(self, PROJECT, choices = ProjectList)

Riaan



More information about the Python-list mailing list