Hi all
I have a problem with my sudoku_solver program. I use a wx.PyWindow to show
the grid, and I use a wx.Caret to show the current position within the grid.
Under certain conditions the caret disappears. The easiest way to reproduce
it is as follows.
Copy the attached 'sudoku_solver.py' and 'sudoku.zip' into the same
directory, and run 'sudoku_solver.py'. You should see the caret flashing,
and if you type in some numbers, you should see them appear at the caret
position and the caret move to the next position. Don't worry about whether
it is a valid puzzle or not.
Press 'Enter', or click 'Solve'. Messages will appear in the text window to
the right, and the label on the 'Solve' button changes to 'Reset'.
Press 'Enter', or click 'Reset'. You can now type in a new puzzle, but the
caret has disappeared. If you type in some numbers, they appear in the
correct position, but still no caret.
This occurs with msw only.
A related, but minor, problem occurs with both msw and with gtk2. I try to
hide the caret when the grid loses focus (e.g. by tabbing to the 'Solve'
button) but it stays visible. I tried wx.Caret.Hide() and
wx.Caret.Show(False), but it made no difference.
Version is 2.8.9.1 in both cases.
Any suggestions will be appreciated.
Thanks
Frank Millman
sudoku_solver.py (11.8 KB)
sudoku.zip (25.4 KB)
Frank Millman wrote:
Hi all
I have a problem with my sudoku_solver program. I use a wx.PyWindow to show
the grid, and I use a wx.Caret to show the current position within the grid.
Under certain conditions the caret disappears. The easiest way to reproduce
it is as follows.
Copy the attached 'sudoku_solver.py' and 'sudoku.zip' into the same
directory, and run 'sudoku_solver.py'. You should see the caret flashing,
and if you type in some numbers, you should see them appear at the caret
position and the caret move to the next position. Don't worry about whether
it is a valid puzzle or not.
Press 'Enter', or click 'Solve'. Messages will appear in the text window to
the right, and the label on the 'Solve' button changes to 'Reset'.
Press 'Enter', or click 'Reset'. You can now type in a new puzzle, but the
caret has disappeared. If you type in some numbers, they appear in the
correct position, but still no caret.
This occurs with msw only.
A related, but minor, problem occurs with both msw and with gtk2. I try to
hide the caret when the grid loses focus (e.g. by tabbing to the 'Solve'
button) but it stays visible. I tried wx.Caret.Hide() and
wx.Caret.Show(False), but it made no difference.
Version is 2.8.9.1 in both cases.
Any suggestions will be appreciated.
Thanks
Frank Millman
There was a thread about the wx.Caret vanishing earlier this month: ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.
Cody Precord answered that question. He said that you had to call win.SetCaret(self.caret) to associate the caret with the window object to make it appear and that the window had to be in focus. I would check both of those conditions...my guess is a focus issue though, based on what he said.
ยทยทยท
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Mike Driscoll wrote:
There was a thread about the wx.Caret vanishing earlier this month:
ActiveState Community - Boosting coder and team productivity with ready-to-use open source languages and tools.
Cody Precord answered that question. He said that you had to call
win.SetCaret(self.caret) to associate the caret with the
window object
to make it appear and that the window had to be in focus. I
would check
both of those conditions...my guess is a focus issue though, based on
what he said.
That seems to have sorted it out. Thanks very much, Mike.
Frank