[英]How to set scrollText border in tkinter?
I am new to tkinter.我是 tkinter 的新手。 My code likes this,
我的代码喜欢这个,
import tkinter
from tkinter import scrolledtext
Win = tkinter.Tk()
Text = scrolledtext.ScrolledText(Win)
Text.pack(padx=10,pady=10)
Win.mainloop()
As you can see,it only have the left border,top border.如您所见,它只有左边框,上边框。 However,it haven't right border and bottom border.
但是,它没有右边框和下边框。
I have watched this How to set border color of certain Tkinter widgets?我看过这个如何设置某些 Tkinter 小部件的边框颜色? .
. And I have tried
highlightbackground=color
, the code is this我试过
highlightbackground=color
,代码是这样的
import tkinter
from tkinter import scrolledtext
Win = tkinter.Tk()
Text = scrolledtext.ScrolledText(Win)
Text.config(highlightbackground="black")
Text.pack(padx=10,pady=10)
Win.mainloop()
it also didn't work.it made no difference.它也不起作用。它没有区别。
In this document: tkinter.scrolledtext — Scrolled Text Widget ,I know that the constructor is the same as that of the tkinter.Text
class.And I have seen The Tkinter Text Widget ,But it didn't have config about the tkinter.Text
border.在本文档中: tkinter.scrolledtext — Scrolled Text Widget ,我知道构造函数与
tkinter.Text
类的构造函数相同。而且我看过The Tkinter Text Widget ,但它没有关于tkinter.Text
配置边界。
What should I do?我该怎么办?
it only have the left border,top border.
它只有左边框,顶部边框。
Because the widget config is relief="sunken"
, So you can try relief="solid"
.因为widget config是
relief="sunken"
,所以你可以试试relief="solid"
。
So this is may solve your problem所以这可能会解决你的问题
import tkinter
from tkinter import scrolledtext
Win = tkinter.Tk()
Text = scrolledtext.ScrolledText(Win,relief="solid")
Text.pack(padx=10,pady=10)
Win.mainloop()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.