Python Forum
[Tkinter] Sudoku solver with tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Sudoku solver with tkinter
#6
Hello,
I changed the complexity of the example to concentrate on the basics.

The function SquareCreate() generates the squares.

I'm trying to read in the values of the entries with the function readin().

In line 24 it is mentioned that "list index ist out of range".

What I am doing wrong?

I ask politely for help...

Greetings, flash77

import tkinter as tk
from tkinter import Entry, IntVar, Tk

def quit_frame():
    main.destroy()

def SquareCreate(): 
    sq=[]
    for j in range(1,4):
        for i in range(1,4):
            data = IntVar()
            t = tk.Entry(main, textvariable=data, justify="center",font=("Arial",16))
            t.place(x=i*40, y=j*40, width=40, height=40)
            t.delete(0)
            sq.append(data)
    return sq

def readin():
    sq=[]
    bo=[]
    for r in range(1,4):
        row=[]
        for c in range(1,4):
            row.append(sq[r*9+c].get())
        bo.append(row)    
    return bo 
            
#mainprogramm
main = tk.Tk()
main.geometry("500x540")
main.resizable(width=0, height=0)
l=tk.Label(main, text="Sudoku Bruteforce Solver")
l["font"]="Arial"
l.place(x=150,y=0)
button1=tk.Button(main, text="quit", command = quit_frame)
button1.place(x=50,y=450)
button2=tk.Button(main, text="readin", command = readin)
button2.place(x=150,y=450)
SquareCreate()
main.mainloop()
Reply


Messages In This Thread
Sudoku solver with tkinter - by flash77 - May-22-2020, 04:29 PM
RE: Sudoku solver with tkinter - by deanhystad - May-22-2020, 05:54 PM
RE: Sudoku solver with tkinter - by flash77 - May-23-2020, 07:06 PM
RE: Sudoku solver with tkinter - by deanhystad - May-24-2020, 03:30 AM
RE: Sudoku solver with tkinter - by flash77 - May-24-2020, 03:41 PM
RE: Sudoku solver with tkinter - by flash77 - May-27-2020, 06:40 AM
RE: Sudoku solver with tkinter - by deanhystad - May-28-2020, 04:30 AM
RE: Sudoku solver with tkinter - by flash77 - May-28-2020, 02:32 PM
RE: Sudoku solver with tkinter - by deanhystad - May-28-2020, 02:45 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020