May-27-2020, 06:40 AM
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
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()