Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################################################
- # using: padx=(1,0), pady=(1,0)
- ##################################################################
- import tkinter as tk
- root = tk.Tk()
- root['bg'] = 'black'
- for c in range(10):
- for r in range(10):
- txt = "({},{})".format(r,c)
- l = tk.Label(root, text=txt)
- #l.grid(row=r, column=c, padx=(1,0), pady=(1,0))
- # skip external lines
- px = (1,0) if c > 0 else (0,0)
- py = (1,0) if r > 0 else (0,0)
- l.grid(row=r, column=c, padx=px, pady=py)
- root.mainloop()
- ##################################################################
- # using: borderwidth=1, relief="solid"
- # (internal lines have size 2px, external lines have size 1px)
- ##################################################################
- import tkinter as tk
- root = tk.Tk()
- root['bg'] = 'black'
- for c in range(10):
- for r in range(10):
- txt = "({},{})".format(r,c)
- l = tk.Label(root, text=txt, borderwidth=1, relief="solid")
- l.grid(row=r, column=c)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement