2014-04-29 1 views
5

tkinter 앱처럼 보이지 않는 tkinter 앱을 만들려고합니다. 나는 ttk 수첩을 사용하고 있으며, 탭을 선택하면 텍스트 주위에이 작은 점선이 탭에 나타납니다. 그것은 끔찍한 보이고, 나는 스타일이나 설정을 사용하여 그것을 제거하는 방법을 찾을 수 없습니다. 여기에 명확하게 스크린 샷입니다 : 코드에 대한Ttk 노트 탭 삭제하기 점선

enter image description here

편집 (나는 실제로 단지 기본 스타일 일을 제거하기 위해 노력하고있어 이후는, 정말 도움이 될 것입니다 생각하지 않습니다.) :

tab1 = ttk.Frame(tabs) 
tab1_frame = ttk.Frame(tab1, style=style.Frame) 
tab1_frame.pack(anchor='center', expand=1, fill='both') 
# stick some widgets in 
progress = ttk.Progressbar(tab1_frame, orient="horizontal", length=300, mode="determinate") 
progress.grid(column=1, row=1, columnspan=2, padx=style.padding, pady=style.padding) 
progress['maximum'] = 1000 
progress['value'] = 500 
# More widgets 
# Another tab 
tab2 = ttk.Frame(tabs) 
tab2_frame = ttk.Frame(tab2, style=style.Frame) 
tab2_frame.pack(anchor='center', expand=1, fill='both') 
# blah blah 
:에 충진

tabs = ttk.Notebook(mainframe, width=319, height=210, style=style.Notebook) 
tabs.grid(column=0, row=1, sticky=('n', 'w', 'e', 's')) 
tabs.columnconfigure(0, weight=1) 
tabs.rowconfigure(0, weight=1) 

: 여기

는 노트북 창조

관련 스타일 :

style_config = Style() 
style_config.theme_use('default') 

style_config.configure(self.Notebook, 
    background=self.dark, 
    borderwidth=0) 

style_config.configure(self.Tab, 
    background=self.dark, 
    foreground='white', 
    padding=self.padding, 
    borderwidth=0) 
style_config.map(self.Tab, 
    background=[('selected', self.color1)]) 
+0

일부 코드가한다면 나도 몰라 내가 당신에게 –

+0

도움이 도움이 될이 기본으로하기 때문에 방법은, 예를 배경으로 그것에게 동일한 색상을 그릴 수 있도록,이 초점 마크의 색상을 변경할 수 모든 테마 (기본값을 사용하고 있습니다)를 제거하려고합니다. 나는 내 대답을 업데이 트거야. – jstaab

답변

5

당신은 탭 위젯의 하위 요소를 변경하여이 포커스 표시를 제거 할 수 있습니다. Ttk 위젯은 subelements으로 분해됩니다. 이러한 요소의 레이아웃은 layout 메서드 (또는 theme_create의 레이아웃 매개 변수)를 통해 설명됩니다. 여기에 (당신이 탭 또는 기타 파생 테마에 직접 적용 할 수 있습니다) 레이아웃 마크를 제거하는 명령은, 주석 부분은 (style.layout("Tab")를 통해 검색) 초점

style.layout("Tab", 
[('Notebook.tab', {'sticky': 'nswe', 'children': 
    [('Notebook.padding', {'side': 'top', 'sticky': 'nswe', 'children': 
     #[('Notebook.focus', {'side': 'top', 'sticky': 'nswe', 'children': 
      [('Notebook.label', {'side': 'top', 'sticky': ''})], 
     #})], 
    })], 
})] 
) 

더 해키 그리기에 이전 될 것입니다

style.configure("Tab", focuscolor=style.configure(".")["background"]) 
+0

굉장; 나는 오늘 이것을 시험해보고 그것이 어떻게 작동하는지 보게 될 것이다! – jstaab

+0

안녕하세요. 그것은 효과가있다! 감사! – jstaab