1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| #!/usr/local/bin/python
# -*- coding:utf-8 -*-
from Tkinter import *
class Application:
def __init__(self, ligne, colonne):
self.root=Tk()
self.root.title('Tableau - v.01')
for k in range(colonne):
b=Button(self.root, text=str(k+1))
b.grid(row=0,column=k+1,sticky=NSEW)
self.root.grid_rowconfigure(0, weight=1)
for m in range(ligne):
b=Button(self.root, text=str(m+1), width=10)
b.grid(row=m+1,column=0,sticky=NSEW)
self.root.grid_rowconfigure(0, weight=1)
self.root.grid_columnconfigure(0, weight=1)
rows = []
for i in range(ligne):
cols = []
for j in range(colonne):
e = Entry(self.root, justify=CENTER)
e.grid(row=i+1, column=j+1, sticky=NSEW)
e.insert(END, '(%d , %d)' % (i, j))
cols.append(e)
self.root.grid_columnconfigure(j, weight=1)
self.root.grid_rowconfigure(i+1, weight=1)
rows.append(cols)
self.root.mainloop()
# départ du programme principal :
if __name__ == "__main__":
f = Application(8,6) |
Partager