The pysfml site didn't really have anything that showed this being used and looking at the C++ version didn't really help either. What I'm trying to do is draw a full progress bar onto the screen but have the texture rectangle set to only show part of it to represent what data has been loaded. What I have right now is this:
self.loadBar.texture_rectangle = sf.Rectangle((0,0),(relativeSize, 20))
But it doesn't work, it still shows the whole thing. Am I not using it right?
(Sorry for not being able to provide now a full working example.)
What I do:
o_texture = sfml.Texture.from_file(s_file) # Full image texture loaded from disk
o_sprite = sfml.Sprite(o_texture) # Creating a sprite from the texture
o_sprite.texture_rectangle = sfml.Rectangle((10, 10), (50, 30)) # "cropping" only the rectangle I want from the full texture
Of course this is a basic example and you should do it with proper coding to keep your texture "alive".
Hope it helps.