How can I fix “Control must be added to the page first.” Error in flet?
I am trying to make a janggi(chess variant) game using flet. As I have to use the board in multiple places, I made a class called janggiBoard which inherits from ft.Stack. I wanted to use drag and drop for the pieces, so I followed the Solitaire tutorial on the flet docs. The problem occured when I tried to do the “move_on_top” part. In the Solitaire code, there is page.update()
in the move_on_top function. So I naturally followed it by adding a piece.board.update()
. However, when I do this, It causes an AssertionError as below.
How can I fix “Control must be added to the page first.” Error while using GestureDetector in flet?
I am trying to make a janggi(chess variant) game using flet. I wanted to use drag and drop for the pieces, so I followed the Solitaire tutorial on the flet docs. The problem occured when I tried to do the “move_on_top” part. Before adding the move_on_top code, things worked perfectly as expected. I could move the pieces around freely. However after I added the move_on_top function, It works sometimes, but it was also causing the AssertionError randomly, and the drag is not working anymore.