Python Forum
[Tkinter] apply command on every list element
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] apply command on every list element
#4
Hello,

Unfortenately I need further help...

First the squares are created by the function SquareCreate().

Then I want to fill in the values of the Sudoku-Puzzle.

After that I click the button to read in the values.

I don't know how to adress the right square by using i and j in the function squareread().

I have got little experience in programming but Python is a new language for me.

Please be so kind and help me, because I'm new to Python.

Greetings, flash77

import tkinter as tk
from tkinter import Entry, IntVar, Tk
fenster = tk.Tk()

fenster.geometry("500x540")
fenster.resizable(width=0, height=0)
l=tk.Label(fenster, text="Sudoku Solver")
l["font"]="Arial"
l.place(x=240,y=0)

def SquareCreate(): 
    for i in range(0, 9):
        for j in range(0,9):
            data = IntVar()
            t = tk.Entry(fenster, textvariable=data, font=("Times New Roman",12))
            t.place(x=i*40+70, y=j*40+80, width=40, height=40)

Square = []            
def SquareRead(): 
    for i in range(0, 9):
        for j in range(0,9):
            data = IntVar()
            Square.append(data)
            
print(Square)

#Hauptprogramm
SquareCreate()
b=tk.Button(fenster, text="einlesen", command = SquareRead)
b.place(x=50,y=450)

fenster.mainloop()
Reply


Messages In This Thread
apply command on every list element - by flash77 - May-12-2020, 06:31 PM
RE: apply command on every list element - by flash77 - May-14-2020, 04:18 PM

Forum Jump:

User Panel Messages

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