simonkrauter / NiGui

Cross-platform desktop GUI toolkit written in Nim
MIT License
718 stars 50 forks source link

[Question] Is it possible to integrate NiGui with async app? #3

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi, I have a console async application, is there a possibility to somehow integrate it with NiGui?

FedericoCeratto commented 6 years ago

@Yardanico: you closed the issue - is that a yes?

ghost commented 6 years ago

@FedericoCeratto well, it's indeed possible but a bit "hacky" because you'll need to call poll() manually. https://github.com/vk-brain/Nickel/blob/755a43b2fa3316e764ffe058aada9ea0fc351da1/src/gui.nim https://github.com/vk-brain/Nickel/blob/755a43b2fa3316e764ffe058aada9ea0fc351da1/src/vkbot.nim#L298

I call app.run() from the main bot module and start a timer so every 25ms bot can do async stuff (and also update the GUI)

(sorry for comments being in Russian)