Hi, interesting tutorial.
However, it speaks about sudoku.zip and the content of it, but i seem not to find where this zip file can be downloaded.
All help appreciated.

Thx

rproffitt 2,339

The .zip files are on page one of this discussion at the end of the tutorial and later in RJ's later replies.

Just came across this post. My wife (ex-IT type as well) is a Sudoku fanatic, and I always used to tell her I'd prefer to beat my brains out writing a program to solve the puzzles than slogging through the mechanics of traditional "pencilling" methods. I also found my eyesight wasn't up to seeing the patterns with all the distractions of poorly written numbers and indistinct crossings-out. (Old eyes - I graduated with my Computerscience degree in 1970.) Anyway, I never got around to writing a program for Sudoku, but I did develop a method and skills to solve ordinary puzzles (not the diabolical ones) without writing any numbers except the final ones. (I call this "Naked Sudoku" - mostly to encourage clicks on the post I wrote!) Not writing any small numbers keeps the view clean, and provides extra mental exercise - not as much as writing a program, but I had my fill of that kind of frustration, learning to write my own wordpress theme. Everything is so abstracted these days, with tools, code generators and helpers piled on top of precompilers and compilers. And then Jetpack and Wordpress interpret your intentions and Google Adsense changes content on the fly and you have to consider varying screen sizes. But that's progress. I think.

Congratulations on navigating a new tool your post. Enjoy your retirement, I do.

Reverend Jim 4,009

Glad you liked it. As I refine my Python/wxPython skills I revisit old projects and clean them up. Here is the latest iteration. I'm still at the lake with limited bandwidth so any questions will have to wait until I get home in a week or so, at which point I have several new Python/wxPython projects to post.

Sudoku Assistant Version 2.40

There are a number of changes and enhancements in this version of Sudoku Assistant.

Mapping

The previous version used `self.rows` and `self.cols` for accessing tiles by row and column as one large grid (rather than within a pane). It was really ugly. I replaced it with `self.map` which should be a lot more straightforward, and added methods to return a list of tiles by row, column, or pane.

Hints

You can now click `Hint` at any time. If Sudoku Assistant detects an orphan digit (one that appears only once in a pane, row, or column) the tile that contains it will be highlighted and the digit will be identified. All other digits in that tile may be safely eliminated. Repeated clicks of `Hint` will reveal other orphans as detected. Because the standard wx.MessageBox dialog can only be displayed on the centre of the screen (in Windows) I wrote a custom dialog to display the hint message. This allowed me to display the dialog and position it so that the OK button was under the mouse cursor.

If you've gotten to the point where manually scanning for orphans, or repeatedly clicking on `Hint` has become tedious you can run this with the `-autohint` command line option. With this option clicking on `Hint` will automatically solve all orphan tiles.

Hotkeys

I finally got around to figuring out how to use accelerators to implement hotkeys. You can now do `CTRL-Z` to Undo, `CTRL-C` to Check, and `CTRL-H` to Hint. It should be easy to add more hotkeys as desired.

Check

The logic that highlighted a row or column with an error had a bug which caused incorrect highlighting in some cases. This has been fixed.

Embedded images

I used the wxPython `img2py.exe` utility that comes with wxPython to convert the `*.jpg` image files that contain the large 1-9 digit images to bytecode strings and put them in `GetImage.py`. This eliminates the necessity of including the image files with the application, although they are still included with the zip file.

Sizers

The previous version attempted to use plain gridsizers with padding determined by positioning within the grid to achieve consistent spacing. Robin Dunn (the creator of the wxPython wrapper) was finally able to explain to my old brain why that wouldn't work. I updated the original layout by placing the gridsizer within an inner panel. This achieves the layout I wanted.

Resizing

As a result of the new sizer layout I think I have now achieved a reasonable method of maintaining a consistent shape when resizing the app. It's not quite perfect but it does work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.