【问题标题】:Tkinter fullscreen leaves borderTkinter 全屏留下边框
【发布时间】:2020-04-15 14:39:10
【问题描述】:

我正在尝试使用 Tkinter 和 Pillow 制作图像幻灯片应用程序。我希望图像全屏显示,所以目前我的代码如下所示(我认为这些都是重要的部分,如果您需要查看更多内容,请询问我):

canvas = Canvas(root, width=screenwidth, height=screenheight, bg=‘black’)#screenwidth and height previously assigned (checked to be correct) variables containing screen dimensions. 
image = image.resize((resizew, resizeh) Image.ANTIALIAS)
imagesprite = canvas.create_image(midx, midy, image=photo) #had changed our resized image to a tkinter photo image previously, midx and midy are just half the screen dimensions.  

问题: 无论我更改什么设置,窗口边缘总会出现某种形式的灰色条。我尝试过更改窗口大小、更改画布大小、使用 root.geometry 手动设置窗口几何形状均无济于事。但是,某些设置组合会导致条数减少;我在 1 和 3 之间看到过。附加了当前状态下的输出图片。 shell中没有错误,不是(当前)图像左侧有边框

[1]:https://i.stack.imgur.com/1DLfg.jpg

【问题讨论】:

    标签: python-3.x tkinter python-imaging-library tkinter-entry


    【解决方案1】:

    创建画布时需要设置highlightthickness=0

    canvas = Canvas(root, width=screenwidth, height=screenheight, bg='black', highlightthickness=0)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-13
      • 2014-10-05
      • 2021-05-12
      • 2014-11-29
      • 2012-04-10
      • 2013-03-17
      相关资源
      最近更新 更多