数独的Python GUI

7lrncoxx  于 2022-12-05  发布在  Python
关注(0)|答案(1)|浏览(128)

什么是最好的方法来为数独制作一个GUI?我已经在Pygame中制作了一个GUI:按钮、单元格数字输入、网格显示;但是即使没有任何变化,每秒绘制30次网格和按钮也感觉不对。有没有更好的方法?

dfddblmv

dfddblmv1#

The safest course is to re-paint the screen, even at 30fps/when nothing is changing.
Secondly, will modifying the code actually make a difference to the load on the PC?
The theme seems to be: if the Sudoku board hasn't changed, why bother? So, put the screen-update 'behind' the same condition which examines input. If the user instructs that a digit is to be inserted in a chosen-square (for example), and thus the appearance of the board is to be changed, then after updating the graphic(s)/sprite positions, the logic must call for a screen-update!
This will be slightly more complicated if you have also changed the mouse-pointer and must update the mouse's appearance as it is moved!

Before you do this, monitor the PC's performance graphs, then perform a Before-After analysis. It'll be interesting to read the results...

Regards =dn

相关问题