2013-10-01 4 views
0

두 줄의 텍스트 위젯을 나란히 놓을 수 있는지 궁금합니다. 줄 바꿈없이. 이 조각에서 볼 수 tkinter에 테두리가없는 두 개의 텍스트가 나란히 있음

내가 그가 borderwidth 무엇 이었다 생각하지만, 거기에 항상 분할 라인 :

from Tkinter import * 
root = Tk()  
cotext = Text(root, borderwidth=0) 
chtext = Text(root, borderwidth=0) 
chtext.grid(column=0,row=0) 
cotext.grid(column=1,row=0) 
mainloop() 

... 아니면 불가능하다?

편집 :이 마지막 시도,하지만 여전히 지금은 괜찮아요

from Tkinter import * 
root = Tk()  
cotext = Text(root, highlightthickness=0) 
chtext = Text(root, highlightthickness=0) 
chtext.grid(column=0,row=0,ipadx=0,padx=0,sticky=E+W+S+N) 
cotext.grid(column=1,row=0,ipadx=0,padx=0,sticky=E+W+S+N) 
mainloop() 

편집을 작동하지 않습니다! 위젯은 키보드 포커스가 사용자에게 알려주는 일 -

from Tkinter import * 
root = Tk()  
cotext = Text(root, highlightthickness=0, borderwidth=0) 
chtext = Text(root, highlightthickness=0, borderwidth=0) 
chtext.grid(column=0,row=0) #,ipadx=0,padx=0,sticky=E+W) 
cotext.grid(column=1,row=0) #,ipadx=0,padx=0,sticky=E+W) 
mainloop() 

답변

2

는 당신이 제로에 borderwidth을 설정 한 가정하면, 분할 선은 아마 highlightthickness입니다. 각 위젯에 대해 0으로 설정하고 (borderwidth을 0으로 유지) 분할 선이 사라집니다. 다른 옵션은 1로 두지 만 위젯 배경과 동일한 색상으로 highlightbackground 속성을 설정합니다.

+0

아니, 어느 쪽도 작동하지 않았다. 0의 highlightthickness는 더 얇지 만 여전히 가시적 인 분할 선을 보여줍니다. bg의 highlightbackground로 1로 설정하면 다시 볼 수 있습니다. 내 바탕 화면이 될 수 있을까요? (Linux fedora13 with KDE) – alessandro

+0

@alessandro : 그것이 당신의 데스크탑 일 수 있다고 생각합니다. 두 위젯에서 'highlightthickness'를 0으로 설정하여 * 특정 * 정확한 * 코드가 여전히 두 위젯 사이에 공백을 표시합니까? 눈금의'sticky' 옵션 인 열의 가중치를 설정하고 grid 명령의'ipadx'와'padx' 옵션을 명시 적으로 0으로 설정하기를 원할 수도 있습니다. 그 중 일부 또는 전부가 위젯 간의 추가 간격을 확보 할 수 있습니다. –

+0

나를 위해 일합니다. @alessandro, _both_'highlightthickness = 0' _and_'borderwidth = 0'을 사용해야합니다. –

관련 문제