Reputation: 1268
I am using RMagicK for Ruby to draw and display images. The problem is that after:
img = rvg.draw()
img.diaplay
control is not returned to the caller immediately. The user has to manually close the window for the program to continue. How can I bypass this behavior?
Upvotes: 0
Views: 158
Reputation: 3009
You could create a sub-process that takes care of displaying the image for you, while you do some processing in the main process.
img = rvg.draw()
pid = fork { img.diaplay }
Process.detach(pid) # wait for the child in another thread.
# more code
Note that, fork is not available in some platforms, like Windows. You might have to use spawn if that's a problem for you.
Upvotes: 1