1 year ago
#329782
E. Epstein
Python Arcade caches textures when requested not to
I'm trying to change the background texture in an Arcade app, however, even though I requested Arcade not to cache textures, it seems as though it does. This is my code:
class Application(arcade.Window):
# ...
def on_draw(self):
if should_change_back: # logic for when is written elsewhere
# get img and edit it
new_imgPath = self.choose_img()
new_img = self.edit_img(new_imgPath)
# save edited image in directory
new_img.save(self.tmpImgPath)
# load texture
arcade.start_render()
background = arcade.load_texture(self.tmpImgPath, can_cache=False)
arcade.draw_lrwh_rectangle_textured(self.l, self.r, self.w, self.h, background)
# ...
Every on_draw
, if the app decided it should change the background, it chooses a new image, edits it in a random way (implemented in edit_img
) and saves it in a certain path (always the same path). I believe that since Arcade sees this is the same path, it thinks the texture is the same and uses its cache, even though it isn't supposed to.
I have tried loading a different texture before re-loading the new one, as well as using arcade.cleanup_texture_cache()
before loading the new texture, and neither worked.
Any help would be appreciated, thanks in advance!
python
caching
arcade
0 Answers
Your Answer