在 Tkinter 上删除小部件的行分隔 [英] Removing line separation of widgets on Tkinter

查看:19
本文介绍了在 Tkinter 上删除小部件的行分隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码,但是有几行将文本小部件与根分隔开.我将如何删除这些线条以使其无缝连接?

I have this code but there are lines separating the text widget to the root. How would I remove those lines so it is seamless?

import Tkinter, tkFont

root=Tkinter.Tk()
root.geometry('+%d+%d' % (0,0)) #controls where the window is
root.geometry('%dx%d' % (400,400)) #controls window size
background_color = "#fff"

root.config(background=background_color)
customFont = tkFont.Font(family="Agency FB", size=200)

text = Tkinter.Text(root, font=customFont, background=background_color)
text.insert("end","42")
text.config(state='disabled')
text.pack()
text.place(x=10,y=10)

root.mainloop()

推荐答案

您可以将 borderwidthhighlightthicknessrelief 选项一起使用.任何一个都应该有效.

You can use borderwidth with highlightthickness or relief options. Either one should work.

text = Tkinter.Text(root, ... , relief="flat")

text = Tkinter.Text(root, ... , borderwidth=0, highlightthickness=0) #thanks to Bryan Oakley

如果您想查看小部件的其他选项,您应该查看 effbot

If you want to check out other options of widgets, you should take a look at effbot

这篇关于在 Tkinter 上删除小部件的行分隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆