Hi, I'm using wxPython 2.4.0.1, Python 2.2.2 on Win98SE.
I have a simple XRC file containing a wxGauge control. I obtain the
control like so:
frame = wxXmlResource_Get().LoadFrame(parent, 'FRAME1')
g = XRCCTRL(frame, 'progress')
But, when I call SetValue like so:
g.SetValue(100)
I get an exception:
Traceback (most recent call last):
...
File "C:\PYTHON22\Lib\site-packages\wxPython\controls.py", line 369, in SetValue
val = apply(controlsc.wxGauge_SetValue,(self,) + _args, _kwargs)
TypeError: Type error in argument 1 of wxGauge_SetValue. Expected _wxGauge_p.
Printing the object I'm trying to call SetValue on gives me:
<C wxGauge instance at _15c11c0_wxGauge95_p>
So, it has something to do with the fact the wxWindows actually creates
an instance of wxGauge95 when asked for a wxGauge, I'm guessing.
The same program works fine on Linux (wxGTK). The wxGauge demo works
fine on the Windows machine.
Hi, I'm using wxPython 2.4.0.1, Python 2.2.2 on Win98SE.
I have a simple XRC file containing a wxGauge control. I obtain the
control like so:
frame = wxXmlResource_Get().LoadFrame(parent, 'FRAME1')
g = XRCCTRL(frame, 'progress')
But, when I call SetValue like so:
g.SetValue(100)
I get an exception:
Traceback (most recent call last):
...
File "C:\PYTHON22\Lib\site-packages\wxPython\controls.py", line 369, in SetValue
val = apply(controlsc.wxGauge_SetValue,(self,) + _args, _kwargs)
TypeError: Type error in argument 1 of wxGauge_SetValue. Expected _wxGauge_p.
This was reported a week or two ago and has been fixed for the next release. In the meantime you can use wxPyTypeCast to convert the wrapper object to the right type.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Sorry, I forgot to mention that I'd seen that message and tried
wxPyTypeCast, with no success.
So, just to make sure, I've changed the code that gets the wxGauge
instance to:
g = wxPyTypeCast(XRCCTRL(frame, 'progress'), 'wxGauge')
I still get the same thing when I print g:
<C wxGauge instance at _15c11c0_wxGauge95_p>
and I still get the same exception as above. Looking at wxPyTypeCast, I
think it's just returning the original object because the Python object
is of the right type. This leads me to the following workaround, which
seems to work fine:
g = wxGaugePtr(ptrcast(g.this, 'wxGauge_p'))
Does this help show what the problem is? Will the fix for the other
wxGauge problem also fix this?
Thanks,
Toby.
···
On Fri, Feb 07, 2003 at 01:10:15PM -0800, Robin Dunn wrote:
Toby Allsopp wrote:
> ...
> Traceback (most recent call last):
> ...
> File "C:\PYTHON22\Lib\site-packages\wxPython\controls.py", line 369,
> in SetValue
> val = apply(controlsc.wxGauge_SetValue,(self,) + _args, _kwargs)
> TypeError: Type error in argument 1 of wxGauge_SetValue. Expected
> _wxGauge_p.
This was reported a week or two ago and has been fixed for the next
release. In the meantime you can use wxPyTypeCast to convert the
wrapper object to the right type.
On Fri, Feb 07, 2003 at 01:10:15PM -0800, Robin Dunn wrote:
Toby Allsopp wrote:
...
Traceback (most recent call last):
...
File "C:\PYTHON22\Lib\site-packages\wxPython\controls.py", line 369, in SetValue
val = apply(controlsc.wxGauge_SetValue,(self,) + _args, _kwargs)
TypeError: Type error in argument 1 of wxGauge_SetValue. Expected _wxGauge_p.
This was reported a week or two ago and has been fixed for the next release. In the meantime you can use wxPyTypeCast to convert the wrapper object to the right type.
Sorry, I forgot to mention that I'd seen that message and tried
wxPyTypeCast, with no success.
So, just to make sure, I've changed the code that gets the wxGauge
instance to:
g = wxPyTypeCast(XRCCTRL(frame, 'progress'), 'wxGauge')
I still get the same thing when I print g:
<C wxGauge instance at _15c11c0_wxGauge95_p>
Ah, I see my prior fix only partially corrected the class type. I'll check in a new fix soon.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!