May-21-2023, 04:03 PM
Your code altered a little. Expands with the window
import tkinter as tk aList = ["Bin 1", "Bin 2", "Bin 3", "Bin 4", "Bin 5","Bin 6", "Bin 7", "Bin 8", "Bin 9", "Bin 10", "Bin 11", "Bin 12", "Bin 13", "Bin 14", "Bin 15"] root = tk.Tk() root['padx'] = 5 root['pady'] = 5 root.title('Feed Bins') root.columnconfigure(0, weight=1) root.rowconfigure(0, weight=1) frame = tk.Frame(root) frame['highlightbackground'] = 'black' frame['highlightcolor'] = 'black' frame['highlightthickness'] = 1 frame.grid(column=0, row=0, sticky='news', padx=5, pady=5) for x in range(5): frame.grid_rowconfigure(x, weight=3, uniform='rows') for y in range(3): frame.grid_columnconfigure(y, weight=3, uniform='cols') label = tk.Label(frame, text=aList[x+(y*5)], relief='raised', font=(None, 16, 'bold')) label['bg'] = 'red' if aList[x+(y*5)] in ['Bin 3', 'Bin 12', 'Bin 14'] else 'gray86' label.grid(column=y, row=x, sticky='news', padx=5, pady=5) btn = tk.Button(root, text='Button', font=(None, 14, 'bold')) btn.grid(column=0, row=1) root.mainloop()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags