Default window colour Tkinter and hex colour codes

前端 未结 7 1507
无人共我
无人共我 2021-02-07 12:52

I would like to know the default window colour in Tkinter when you simply create a window:

root = Tk()

If there is one, it is possible to set w

7条回答
  •  广开言路
    2021-02-07 13:33

    rudivonstaden's answer led me to a solution to the problem, although for some reason root.cget("bg") fails because "bg" is an unknown color name.

    However, knowing that a widget has a dictionary containing its properties means that root["bg"] returns the background color of the widget.

    So if you create a window named myWindow without overriding your system's default background color, then myWindow["bg"] is the default background color for a window, which can be used when creating frameless text fields within that window.

提交回复
热议问题