[wxPython-users] First wxpython program: a sudoku program
Jason Wang
randomtalk at gmail.com
Sun Oct 1 17:16:38 PDT 2006
On 9/20/06, Alexei Vinidiktov <alexei.vinidiktov at gmail.com> wrote:
> Is the program supposed to draw numbers in the squares? I can only see
> blue squares and no numbers. I'm on Win XP and wxPython 2.6.3.2
wow i didn't realize that i got this email for a long time, sorry
about that. Well, user is suppose to input numbers into the program,
try cilcking on any square and put numbers in.
On 9/20/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:
> Only a quick perusal, but:
>
> looping through all the rects to find the one clicked on is unnecessary.
> With a rectangular grid, it should be easy to calculate which grid box
> you're in by knowing the origin of the gird, and the size of the boxes.
>
> My tendency would be to calculate the geometry of the grid in the OnSize
> handler, and then use that geometry both to draw the grid, and to figure
> out what box the mouse is in. You could also use it to figure out what
> part of the grid needed to be re-drawn, as Robin suggested.
>
> On Linux, the black font on blue background is very hard to see, and the
> font is pretty small. It looks like you're using defaults. You might
> want to pick a font size based on your grid box size, and use:
>
> wx.FontFromPixelSize to set the size. That should give similar results
> regardless of screen resolution. I've enclosed a version that does this.
>
> Why not have the grid fill the Window? you could even re-size the window
> to stay square. If not that, then it should at least be centered.
>
> I still don't understand why you're re-init-ing the buffer in an IDLE
> event. I guess it's not a big deal but there are a LOT of IDLE events!
>
> I'd tend to want to store your values in some kind of 2-d structure:
> either nested lists, or better yet, a numpy array.
>
Thank you so much for the suggestions! I've modified the program
according to the suggestions and is expanding the program to do more,
with any luck, i might even make it a full featured puzzle solver :D
--
"It's a wonderful world hobbes ol' buddy, let's go explorin'!" -
Calvin in "Calvin and Hobbes"
More information about the wxpython-users
mailing list