Closed pygg2devs closed 12 years ago
Before 0.1.3, you need to use Sprite.texture_rect
. The problem it had is that texture_rect
's getter returned a copy, and that was confusing for a property, e.g. sprite.texture_rect.top = 3
wouldn't work as expected. (get_texture_rect()
still returns a copy, by the way.)
but set_texture_rect should still be able to be used to assign which region of a texture a sprite is, correct?
Before 0.1.3? It wasn't available back then, you had to use Sprite.texture_rect
. If you use texture rects, there is no way to write code that is compatible with e.g. 0.1.2 and 0.1.3 (unless you find the right attribute with hasattr
and then use it, but it's overkill). Is this what you're asking?
but python keeps complaining that set_texture_rect is set to read only.
The following code does not work sprite = sfml.Sprite(self.texture) sprite.set_texture_rect = sfml.IntRect(0, 0, 9, 13)
You need to pass the rect as an argument:
sprite.set_texture_rect(sfml.IntRect(0, 0, 9, 13))
... i'm stupid
it seems that you cannot modify/set the texture coordinates of a texture of a sprite, since that method was introduced in pysfml 0.13
I am running Win7/64bit.