1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| def cb_level1():
size=(5,5)
for n in range(25):
c = divmod(n, size[1])
root[c] = Button(root[2], font=fnt, width=3, height=1,
command=lambda cell=c: cb_cell(cell))
root[c].grid(column=c[0], row=c[1], sticky=N+E+W+S)
for n in range(size[0]): root[2].columnconfigure(n, weight=1)
for n in range(size[1]): root[2].rowconfigure(n, weight=1)
# ----------------------------------------------------------------------------
root[0].title("Mine"); root[0].update_idletasks()
root[0].minsize(root[0].winfo_width(), root[0].winfo_height())
root[0].resizable(1,1); root[0].protocol("WM_DELETE_WINDOW", root[0].quit)
root[0].mainloop(); root[0].destroy() |
Partager