scottsilverlabs / raspberrystem

raspberrySTEM(TM) Educational and Hobbyist Development Kit based on the Raspberry Pi
www.raspberrystem.com
Apache License 2.0
3 stars 0 forks source link

LEDText width should be a member function #74

Closed brian-silverman closed 10 years ago

brian-silverman commented 10 years ago

LEDText correctly reports the width, but as a member variable not a function. It should inherit the functionality from LEDSprite.

That is:

x = led_matrix.LEDText("Hello World!")
print x.width # Prints correct width
print x.width() # TypeError: 'int' object is not callable
jpsnyder commented 10 years ago

Looking into this. It looks like we can't have a member variable and a member function of the same name. (The variable overrides the function.) The solution to this is we rename the member variable or member function. I suggest we rename the member variable because the led_matrix has a led_matrix.width() function as well...

Obviously, this change will break a bunch of programs. What do you propose?

brian-silverman commented 10 years ago

Lets hold off on this change for the demo (but you're welcome to do it in your own branch).

On Thu, Sep 11, 2014 at 9:02 PM, Jonathan Snyder notifications@github.com wrote:

Looking into this. It looks like we can't have a member variable and a member function of the same name. (The variable overrides the function.) The solution to this is we rename the member variable or member function. I suggest we rename the member variable because the led_matrix has a led_matrix.width() function as well...

Obviously, this change will break a bunch of programs. What do you propose?

— Reply to this email directly or view it on GitHub https://github.com/scottsilverlabs/raspberrystem/issues/74#issuecomment-55349868 .

Brian

jpsnyder commented 10 years ago

Thats what I was thinking.