2021年3月20日星期六

Background color of tk.Frame() remains grey

My code:

import tkinter as tk  from tkinter import ttk    win = tk.Tk()    home_frame = tk.Frame(win)  home_frame.grid(column = 0, row = 0)  home_frame.config(bg = 'blue', relief = 'raised')    logo = tk.Label(home_frame)  logo.grid(column = 0, row = 0)  logo.config(text = 'Widget', font = ('Helvetica', 30), fg = 'red')    win.config(bg ='white')  win.mainloop()  

Note that:

home_frame.config(bg = 'blue', relief = 'raised')  

From this, I would expect that the background of the frame turns blue, yet it doesn't. It remains grey.

Output:

output

As far as I'm concerned, tk.Frame() does have bg as an option.

https://stackoverflow.com/questions/66728208/background-color-of-tk-frame-remains-grey March 21, 2021 at 10:07AM

没有评论:

发表评论