스크롤 막대에 약간 문제가 있습니다. 기능적으로 모든 것이 잘 작동합니다. 스크롤 막대가 나타나 텍스트 위젯에 삽입하고 스크롤하는 작업에 반응합니다. 하지만 응용 프로그램을 시작하자 마자 응용 프로그램 창 크기를 조정할 때까지 모든 스크롤 막대의 화살표 단추가 회색으로 표시됩니다. 그리드 설정에서 내 프레임에 대해 기본적으로 잘못된 점이 있습니까? 나는 Upper Left (UL), Upper Right (UR), Lower Left (LL), Lower Right (LR)로 나누었다.파이썬 Tkinter 스크롤바 화살표가 회색으로 희미합니다.
import Tkinter
from Tkinter import *
class findhash_tk(Tkinter.Tk):
def __init__(self, parent):
Tkinter.Tk.__init__(self, parent)
self.parent = parent
self.initialize()
def initialize(self):
self.frameUL = Tkinter.LabelFrame(self, text="Upper left")
self.frameUL.grid(row=0, column=0, sticky=W+E+N+S, padx=2, pady=2)
self.frameUR = Tkinter.LabelFrame(self, text="Upper right")
self.frameUR.grid(row=0, column=1, sticky=W+E+N+S, padx=2, pady=2)
self.frameLL = Tkinter.LabelFrame(self, text="Lower left")
self.frameLL.grid(row=1, column=0, sticky=W+E+N+S, padx=2, pady=2)
self.frameLR = Tkinter.LabelFrame(self, text="Lower right")
self.frameLR.grid(row=1, column=1, sticky=W+E+N+S, padx=2, pady=2)
self.scrollbarUR = Tkinter.Scrollbar(self.frameUR, orient='vertical')
self.scrollbarUR.grid(row=0, column=1, sticky=N+S)
self.textBoxUR = Tkinter.Text(self.frameUR)
self.textBoxUR.config(yscrollcommand=self.scrollbarUR.set)
self.textBoxUR.grid(row=0, column=0, sticky=W+E+N+S)
self.scrollbarUR.config(command=self.textBoxUR.yview)
self.scrollbarLLV = Tkinter.Scrollbar(self.frameLL, orient='vertical')
self.scrollbarLLV.grid(row=0, column=1, sticky=N+S)
self.scrollbarLLH = Tkinter.Scrollbar(self.frameLL, orient='horizontal')
self.scrollbarLLH.grid(row=1, column=0, sticky=W+E)
self.textBoxLL = Tkinter.Text(self.frameLL)
self.textBoxLL.config(wrap="none", yscrollcommand=self.scrollbarLLV.set, xscrollcommand=self.scrollbarLLH.set)
self.textBoxLL.grid(row=0, column=0, sticky=W+E+N+S)
self.scrollbarLLV.config(command=self.textBoxLL.yview)
self.scrollbarLLH.config(command=self.textBoxLL.xview)
self.scrollbarLRV = Tkinter.Scrollbar(self.frameLR, orient='vertical')
self.scrollbarLRV.grid(row=0, column=1, sticky=N+S)
self.scrollbarLRH = Tkinter.Scrollbar(self.frameLR, orient='horizontal')
self.scrollbarLRH.grid(row=1, column=0, sticky=W+E)
self.textBoxLR = Tkinter.Text(self.frameLR)
self.textBoxLR.config(wrap="none", yscrollcommand=self.scrollbarLRV.set, xscrollcommand=self.scrollbarLRH.set)
self.textBoxLR.grid(row=0, column=0, sticky=W+E+N+S)
self.scrollbarLRV.config(command=self.textBoxLR.yview)
self.scrollbarLRH.config(command=self.textBoxLR.xview)
for x in range(50):
self.textBoxUR.insert(END, str(x) + "\n")
for x in range(50):
self.textBoxLL.insert(END, str(x) + "\n")
for x in range(50):
self.textBoxLR.insert(END, str(x) + "\n")
if __name__ == "__main__":
app = findhash_tk(None)
app.title('Test App')
app.mainloop()
나는 아래에'self.update()'를 넣으려고했지만 아래에서는 작동하지 않았다. 당신이 제안한 곳에 그것을두면 "LL"수평 스크롤바 화살표가 회색으로 남습니다. – ManuMeadow
두 가로 스크롤 막대 (아래쪽이 오른쪽 아래입니까?)는 회색으로 표시됩니다. 스크롤 할 내용이 없습니다. 이 동작을 변경 하시겠습니까? – kabanus
아니요, 전혀 아닙니다. 하지만 솔루션과 일관성이 없습니다. 모든 화살표가 검은 색으로 표시되며, 오른쪽 아래의 가로 막대도 검정으로 표시됩니다. 왼쪽 하단 만 회색으로 유지됩니다. – ManuMeadow