Closed esad closed 2 years ago
Sorry. Not a Mac user. There are a couple of Mac users at the SWI-Prolog forum: https://swi-prolog.discourse.group/
See also archives of SWI forum (both discourse and before).
Thanks for report.
NA
On Tue, 19 May 2020 04:26:03 -0700 Esad Hajdarevic notifications@github.com wrote:
Calling e.g.
<- plot(c(1,2,3))
will open a new window, but it's completely unresponsive.-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/nicos-angelopoulos/real/issues/2
Hi! I'm working on a fix, as having plots from SWI-Prolog would be really handy. What platform are you using? Does the UI work there with real - can you resize and move the plot window etc.?
So it seems that R_ProcessEvents
should be called regularly to service the UI events like windows etc. It's exposed in R through process.events()
, which we can call via real from Prolog:
r_ui_loop :-
<- invisible(process.events()),
alarm(0.1, r_ui_loop, _, [install(true), remove(true)]).
Now we can start the timer in the background with r_ui_loop.
from toplevel and enjoy the plots :)
I am not sure if other platforms somehow install the UI handler automatically and if this is Mac-specific. If not, maybe we could add the UI loop by default to r_init or even move it to C code.
Dear Esad,
Glad you resolved this. Will be getting a Mac in a few weeks, so might have opportunity to incorporate this. Please contact via http://stoics.org.uk/~nicos/sware/contact.html for a chat.
Thanks for using Real,
Nicos
On Wed, 20 May 2020 00:25:19 -0700 Esad Hajdarevic notifications@github.com wrote:
So it seems that
R_ProcessEvents
should be called regularly to service the UI events like windows etc. It's exposed in R throughprocess.events()
, which we can call via real from Prolog:r_ui_loop :- <- invisible(process.events()), alarm(0.1, r_ui_loop, _, [install(true), remove(true)]).
Now we can start the timer in the background with
r_ui_loop.
from toplevel and enjoy the plots :)-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/nicos-angelopoulos/real/issues/2#issuecomment-631289290
Hi Nicos,
it's not completely resolved yet. I've stumbled upon issue where running an alarm handler in the loop causes problem with socket connections, see https://swi-prolog.discourse.group/t/running-alarm-in-a-loop-causes-socket-already-connected-errors/2378 - I think I found the cause and have submitted patch to clib package.
Also the handler should probably be invoked directly via send_r_command
to avoid emitting debug messages for process.events().
Have you ever used real on other platform to do interactive stuff like plots? I'm wondering how it ever worked without explicit call to process the events.
And yes, thank you very much for your work on real! It's amazing to be able to integrate Prolog and R this seamlessly.
Hi Esad,
Yes. Real works reasonably well with Linux and (as far as i know) Windoz plots. You don't usually manipulate the plot windows yourself. You typically create the plot window via commands from the SWI prompt/programs.
eg. ?- <- plot( c(1,2,3) ).
will create a new window and place the plot there. Under linux you cannot manipulate this manually (eg maximising to full screen will make the plot within disappear). But this is not really a limitation, as you can create any size with x11().
eg
?- <- x11(width=14,height=7). ?- <- plot( c(1,2,3) ).
There are some expert Mac users on the SWI-Prolog forum, if you are still having problems.
Nicos
On Sat, 23 May 2020 13:46:06 -0700 Esad Hajdarevic notifications@github.com wrote:
Hi Nicos,
it's not completely resolved yet. I've stumbled upon issue where running an alarm handler in the loop causes problem with socket connections, see https://swi-prolog.discourse.group/t/running-alarm-in-a-loop-causes-socket-already-connected-errors/2378 - I think I found the cause and have submitted patch to clib package.
Also the handler should probably be invoked directly via
send_r_command
to avoid emitting debug messages for process.events().Have you ever used real on other platform to do interactive stuff like plots? I'm wondering how it ever worked without explicit call to process the events.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/nicos-angelopoulos/real/issues/2#issuecomment-633136914
Hi Nicos, plots are still not working on Mac, did you maybe find a solution in the meantime?
Sorry, I have no access to Macs. Happy to consider patches. If you are building from sources, it could be not too difficult to investigate.
Regards,
Nicos
On Mon, 13 May 2024 08:50:33 -0700 Esad Hajdarevic @.***> wrote:
Hi Nicos, plots are still not working on Mac, did you maybe find a solution in the meantime?
Calling e.g.
<- plot(c(1,2,3))
will open a new window, but it's completely unresponsive. I also tried calling plot in another thread withthread_create(<- plot(c(1,2,3)), _Id).
, which crashes with the following stacktrace: