Numeric + wxPython, can't understand a bug...

John Ladasky ladasky at my-deja.com
Fri Apr 27 20:56:17 EDT 2007


Hi, folks,

This probably has to do with Numeric and not with wxPython, but I
mention both for completeness.

My OS: Win2000
Python: 2.3.4
wx: 2.6.1.0, Unicode version
Numeric: 23.8


Here's the minimal code:
================================================

height = 50
width = 60
L = []
for y in range(height):
    for x in range(width):
        L.append(wx.Point(3+(2*x+y%2)*4, 3+7*y))
print width, height, len(L)
pos = reshape(array(L), (height, width))



And here's the output:
================================================

60 50 3000

pos = reshape(array(L), (height, width))
ValueError: total size of new array must be unchanged



I've used exactly this approach to create 2D arrays from lists of
numbers, with no problems.  Why does this fail with wx.Point objects?
Why is it telling me that I'm changing the array size, when the
dimensions indicate that I am NOT?  Typecasting the array as
containing PyObject items does not change the error message...

Thanks for any advice!



+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
|   Ladasky Home Solar, Inc.:  blowing sunshine up your   |
|       power grid since March 24, 2005.  Fiat lux!       |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
|   Uptime    Downtime    kWh generated     kWh consumed  |
|   744 days  13 hours        12886            14321      |
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+




More information about the Python-list mailing list