在 Tkinter 上删除小部件的行分隔

编程入门 行业动态 更新时间:2024-10-25 02:26:40
本文介绍了在 Tkinter 上删除小部件的行分隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

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

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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 06:15:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390765.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:部件   Tkinter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!