Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Online Python compiler (interpreter) to run Python online.
- # Write Python 3 code in this online editor and run it.
- import tkinter
- import random
- list_b=[[],[],[],[],[]]
- for i in range (5):
- for j in range (5):
- list_b[i].append(Label(tk, bg = 'lightblue', width = 4))
- list_b[i][j].grid(row = i, column = j, padx = 2, pady = 2)
- def output():
- for i in range (5):
- for j in range (5):
- list_b[i][j].config(text = str(a[i][j]))
- Label(tk, text = 'Координати верхнього лівого кута:').grid(row = 5,column = 0, columnspan = 5)
- enx1 = Entry(tk, width = 3)
- enx1.grid(row = 6, column = 1)
- eny1=Entry(tk, width = 3)
- eny1.grid(row = 6, column = 3)
- envart = Entry(tk, width = 6)
- envart.grid(row = 10, column = 2)
- but = Button(text = 'Обчислити', command = but_click, width =14).grid(row = 9, column = 0, columnspan = 5)
- def but_click():
- x1 = int(enx1.get())
- y1 = int(eny1.get())
- x2 = int(enx2.get())
- y2 = int(eny2.get())
- vart = 0
- for i in range(x1, x2+1):
- for j in range(y1, y2+1):
- vart = vart+a[i][j]
- envart.delete(0, END)
- envart.insert(0, str(vart))
- tk.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement