Web lists-archives.com

gtk-main-iteration -- use and understanding


I have some problems to understand and correctly use this function.

Last week I wrote a toy chess game from scratch in Nim language, just
to get some more experience with Nim and to have one more test and
example for my Nim GTK3 bindings. For the plain GUI display with chess
pieces drawn with unicode fonts I followed well known C examples code.

My chess engine replies synchronously within less than one second --
well that may be not really good design, but for now that is OK for me.

When human made a move, I wanted to update display at once, before
reply is called. I found out fast that calling gtk-main-iteration is
necessary. But it seems to be necessary to call that at least twice! I
do not really understand why, or when that is really necessary, how I
can call it in a loop.

http://ssalewski.de/tmp/toychess.png (picture of the board)

File board.nim, lines 94 .. 96
gtk-list mailing list