In Kivy, is there a way to dynamically change the shape of a texture?

Multi tool use


In Kivy, is there a way to dynamically change the shape of a texture?
I'm working on a scientific visualization tool using Kivy in which I display a set of 2D data to the user. Essentially, I create a texture with the same size as my data set using something like my_texture = Texture.create(size=(my_data_x, my_data_y))
. I use my_texture.blit_buffer(Data_set)
to blit it onto the canvas and display it and it all works great. The problem is: I want to allow the user to be able to change the size of the data set while the program is running. Since the data size is changing, I need to have a texture that also has the new size. I've tried reassigning the my_texture
variable to a newly created texture, but what's actually being shown on the screen is the texture right before the change.
my_texture = Texture.create(size=(my_data_x, my_data_y))
my_texture.blit_buffer(Data_set)
my_texture
So my question is: is there a way to appropriately create textures after my program is already running and get them to display on the canvas, or do textures always have to be generated on startup? Alternatively, is there a way I can reshape an already existing texture?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.