I need to create table of buttons using Tkinter in Python 2.7, which has n
rows and n
columns, and has no button in bottom right corner.
P
This is the way I tried to do this and problem is that I still don't know how to get row and column of pressed button...
from Tkinter import *
#Input:
n = int(raw_input("Input whole positive number: "))
L = range(1,n+1)
k = n
m = n
#Try putting values for k and m which are less then n and you will see what i need to get
#Moving:
def Move():
#This i cant fill
return k,m
#Program:
root = Tk()
for i in L:
for j in L:
frame = Frame(root)
frame.grid(row = i,column = j)
if i == int(k) and j == int(m):
pass
else:
button = Button(frame, command = lambda: Move())
button.pack()
root.mainloop()
So by changing k
and m
values gap is created on other place...