On 20/04/17 10:33, Phil wrote: >> So, for a Suduko grid put 3x3 Entry boxes into a Frame. >> Then put 3x3 such frames into another frame. > > OK, so I'll go back to my original idea and use edit boxes. A grid of 9 x 9 > edit boxes does actually work and it makes it easy to keep track of the > digits. The first digit is [0,0], the first digit on the second line is [1,0] > etc.
Nine 3 x 3 boxes could add some complication to digit tracking. Its not too bad you can map the large 9x9 table to the smaller units using divmod() So the 7th element becomes divmod(7) -> 2,1 ie. element 7 maps to the 2nd cell, element 1 You can create a simple helper function that takes an x,y pair from the 9x9 view and returns two pairs identifying the cell coordinates. And having the smaller 3x3 cells works when checking that each 3x3 cell has the 9 unique numbers too. > I did actually get my canvas version to the point where I could > enter digits into the cells but I had to enter them in sequence Yes, that's exactly the kind of problems you hit and its a terrible user experience. Far better to use the facilities the GUI gives you for free. For example tab will move the cursor from cell to cell etc. > Thank you for the table example. I'm not sure what "tab = DisplayTable" It creates an instance of the table. tab = DisplayTable(top, # the containing widget/frame ["Left","Right"], # table headings [[1,2], # The table data, 3x2 items [3,4], [5,6]], datacolor='green') # the color used to draw the data Note: the constructor allows other colours to be specified too such as the headings the grid lines and the cell background. You may want to hard code those in a simplified version of my class. Hopefully when you run it you'll understand, especially if you tweak the example instance options. For example here is a full featured version: tab = DisplayTable(top, ["Left","middle","Right"], [[1,2,1], [3,4,3], [5,6,5]], datacolor='blue', cellcolor='yellow', gridcolor='red', hdcolor='black') If still confused drop a question here. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor