Jump to content
Private Messaging is activated - check "How to" on how to disable it ×

Image created with matplotlib cannot be found for dialog in Zeiss Inspect V23


---
 Share

Recommended Posts

---

Dear,

I have created poxplots in matplotlib to show in a dialog in Zeiss Inspect V23. The poxplots are properly generated and do exist (see below) however when I want to show them in a Inspect dialog using the code suggested under  "https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/howtos/faq/faq.html#how-can-i-use-an-image-from-a-script-resource-file-in-a-user-defined-dialog". I get an error message that the resources cannot be found (see below). What's wrong? Does the resources have to be saved in a specific folder to be used in the dialog?

 

Thanks for you help 

 

Code for Dialog.JPG

Code Link.JPG

Error Message.JPG

Folder with Graph.JPG

Test_12345_V12345_952_graph.png

Link to comment
Share on other sites

---

Hi,

the FAQ article you mentioned shows how to use an image file embedded in an App via `gom.app.resource`.

To display an image from an regular file, you can just read it into a variable:

import gom

if __name__ == '__main__':
	with open("C:/Temp/example.png", "rb") as f:
		image = f.read()
	
	DIALOG=gom.script.sys.create_user_defined_dialog (file='dialog.gdlg')

	DIALOG.image.data = image

	gom.script.sys.show_user_defined_dialog (dialog=DIALOG)

Best regards,

Matthias

Edited
Link to comment
Share on other sites

---

Thank you Matthias! That worked and solved the problem.

 

With kind regards,

Simon

Link to comment
Share on other sites

 Share

×
×
  • Create New...