Hi im Jordan,
I’m still somewhat new to coding so I would be very grateful for some help.
I am trying to set up a UI window that displays an image that is corresponding to a selection in a ListBox.
I have an initial placeholder image that is displaying correctly, and is used when there is no selection from the ListBox. But when I make a selection from the ListBox that has a new Bitmap associated to load for that selection, it is crashing Rhino, and I am wondering if there is a specific step that I am missing when trying to call a new image when the selection is changed.
Here is a code snippit of how the Placeholder image is set originally for the UI.
self.previewimage = ImageView()
self.previewimage.ToolTip = "A preview of the Luminaire."
self.previewimage.Image = Bitmap(RootFolder + Imagery + "\PlaceHolder.jpg")
self.previewimage.Height = 150
self.previewimage.Width = 150
Here is a snippit of my code for how the new image is called to replace the placeholder image.
def Get_Preview_Image(self, sender, e):
LumPreview = "\PlaceHolder.jpg"
if self.LumLib.SelectedIndex == 0:
LumPreview = "\\" + self.LumLib.DataStore[0].replace(".3dm",".jpg")
self.previewimage.Image = Bitmap(RootFolder + Imagery + LumPreview)
elif self.LumLib.SelectedIndex == 1:
LumPreview = "\\" + self.LumLib.DataStore[1].replace(".3dm",".jpg")
self.previewimage.Image = Bitmap(RootFolder + Imagery + LumPreview)
else:
print("Selection not set up yet.")
The string representation for LumPreview is returning correctly to what is required, hence why I am unsure as to why it is crashing unless I am missing a step or have gone about the transition of imagery in the wrong way.
Any help is greatly appreciated.
Jordan
5 posts - 3 participants