我使用此代码使用Tkinter和python 3.5制作滚动文本窗口,我很好奇我可以做些什么来改变滚动文本的字体大小和颜色。
import tkinter as tk
root = tk.Tk()
deli = 100 # milliseconds of delay per character
svar = tk.StringVar()
labl = tk.Label(root, textvariable=svar, height=5)
def shif():
shif.msg = shif.msg[1:] + shif.msg[0]
svar.set(shif.msg)
root.after(deli, shif)
shif.msg = 'Text example: Blah, Blah Blah'
shif()
labl.pack()
root.mainloop()
答案 0 :(得分:0)
您只是不能更改font-size
中的Scrollbar
,因为它没有字体大小。
您可以更改font-size
中的Text
。它有一个字体模块。
textarea = Text(root, font=("Arial 45"))
答案 1 :(得分:-1)
def create_scrolltext(self):
F_font = ('bold', 30)
scroll_w = 30
scroll_h = 10
scrollText = scrolledtext.ScrolledText(self, width=scroll_w, height=scroll_h, wrap = tk.WORD, font=F_font)
scrollText.grid(column=0, columnspan=3)
答案 2 :(得分:-1)
def create_scrolltext(self):
F_font = ('bold', 30)
scroll_w = 30
scroll_h = 10
scrollText = scrolledtext.ScrolledText(self, width=scroll_w, height=scroll_h, wrap = tk.WORD, font=F_font)
scrollText.config(bg='white', fg='blue')
scrollText.grid(column=0, columnspan=3)