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
#1
Hello,
I'm totally new in programming in python.

I'm planning to write a sudoku solver in python. I have a frame with 81 entries on it and I want to read the values of each entry with '.get()'.
Therefore I got a list with all entries and I want to apply the command '.get()' to each element of the list. How that could be done?

Thanks a lot for your help!!

Greetings, flash77

import tkinter as 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 tboxErzeugen():
    for i in range(0, 360, 40):
        for j in range(0, 360, 40):
            t= tk.Entry(fenster, font=("Times New Roman",12))
            t.place(x=i+70, y=j+80, width=40, height=40)

def test(a):
    if type(a)==tk.Entry:
        return True
    else:
        return False

tboxErzeugen()
b=tk.Button(fenster, text="einlesen", command = test)
b.place(x=50,y=450)

w = []
w = fenster.winfo_children()
u = filter(test,w)
e = []
for i in u:
    print("True:",i)
    e.append(i)
print(e)

fenster.mainloop()
Reply


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

Forum Jump:

User Panel Messages

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