简体   繁体   English

窗口未完全填充特定背景颜色 - tkinter

[英]Window not fully filled with specific background color - tkinter

Recently i've been trying to make a simple GUI with tkinter in python but for some reason the background color doesn't fully fill the window with the specific color最近我一直在尝试用 python 中的 tkinter 制作一个简单的 GUI,但由于某种原因,背景颜色没有用特定颜色完全填充窗口

eg:例如:

在此处输入图片说明

How do i fill all the sides?我如何填满所有的边?

Any replies are greatly appreciated ;-)非常感谢任何答复;-)

First of all, you need to also attach a minimal reproducible example.首先,您还需要附上一个最小的可重现示例。 Nevertheless, I think you have put a canvas with the colour you want and expanded it to 1.尽管如此,我认为您已经放置了一个带有所需颜色的canvas并将其扩展为 1。

Canvases in Tkinter always have a border like thing. Tkinter 中的画布总是有一个类似边框的东西。 Rather you can use a frame with the same colour (instead of the canvas) and the border will disappear.相反,您可以使用具有相同颜色的frame (而不是画布)并且边框将消失。 The other option is to configure your root to have its own colour like such:另一种选择是将您的根配置为具有自己的颜色,如下所示:

root.config(bg='red')

Either way, you will have to then delete your canvas and place its widgets into either the frame or the root itself.无论哪种方式,您都必须删除画布并将其小部件放入框架或根本身。

If this works, please accept this answer.如果这有效,请接受此答案。 Hope it was helpful.希望它有帮助。 Thank you!谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM