0

I am scripting a SystemC simulation demo under VLAB.

How can I display an image on the screen, as one of the things the demo does at it runs?

I tried opening a window and displaying an image using wx, but this required me to create a wxApp, which blocked the thread of my demo.

Edit:

This question almost amounts to the same question that is often asked: "How can I display an image in Python?", because the VLAB interpreter is Python. However, I'm looking for a solution that doesn't require me to point VLAB at third party libraries.

GreenAsJade
  • 14,459
  • 11
  • 63
  • 98

1 Answers1

0

One simple easy way turns out to be to call on an external app to do this.

On Windows:

import os
os.startfile("myimage.png")

On Linux (Ubuntu):

import os
os.system("xdg-open myimage.png") 

This is a little "hacky" in that it is not portable, but for a demo it does the job for me.

Edit:

I found a way that could be considered more portable:

import webbrowser
webbrowser.open("/full/path/to/myimage.png")

Anything more elegant very welcome.

GreenAsJade
  • 14,459
  • 11
  • 63
  • 98