And then when doing mouse down on image area, I’d like to show image
What I’ve tried and what’s not working:
I uploaded image to asset
In the mouse down event, I assigned that image to image.source and image.visible = True
I first used directly “”/theme/X-LETTER.png"" and as a second, URLMedia("/theme/X-LETTER.png")
But nothing is shown when pressing
Code Sample:
# code snippet
class Form1(Form1Template):
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
# Any code you write here will run when the form opens.
def image_1_mouse_down(self, x, y, button, **event_args):
"""This method is called when a mouse button is pressed on this component"""
print("image_1_clicked")
self.image_1.source = URLMedia("_/theme/X-LETTER.png")
self.image_1.visible = True
def image_1_mouse_down(self, x, y, button, **event_args):
"""This method is called when a mouse button is pressed on this component"""
print("image_1_clicked")
self.image_1.source = "_/theme/X-;Letter.png"
self.image_1.visible = True
But it works after changing file name. “;-” seems not working.
def image_1_mouse_down(self, x, y, button, **event_args):
"""This method is called when a mouse button is pressed on this component"""
print("image_1_clicked")
self.image_1.source = "_/theme/X.png"
#self.image_1.visible = True
def image_2_mouse_down(self, x, y, button, **event_args):
"""This method is called when a mouse button is pressed on this component"""
print("image_2_clicked")
self.image_2.source = "_/theme/O_Letter.png"
#self.image_2.visible = True
Since it’s already solved, I don’t have old version which had the problem.
In short, hyphen, “-”, seems not supported in file name.
It didn’t work if it includes hyphen but OK after replacing hyphen with underscore or removing it.