Advertisement
here2share

# Tk_3x4_btns.py

Dec 25th, 2021
1,329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. # Tk_3x4_btns.py
  2.  
  3. import tkinter as tk
  4.  
  5. root = tk.Tk()
  6.  
  7. testList = ['A','B','C']
  8.  
  9. nrows = 4
  10. ncols = 3
  11. for r in range(nrows):
  12.     for c in range(ncols):
  13.         btn = tk.Button(text=f'{testList[c]} : {c} : {r}' ,padx=50, pady=50)
  14.         btn.grid(row = r, column=c)
  15.  
  16. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement