2011-04-21 2 views
0

라디오 버튼 도트의 색상 (즉, 다이아몬드/원의 채우기 색상 만)을 수정할 수 있습니까? 오래된 다이아몬드를 얻기 위해 이미 고전적인 테마를 사용하고 있습니다. 그러나 불행하게도 다이아몬드의 채움 색상은 항상 약간의 빨강을 띠고 밝은 녹색이 필요합니다.Tcl/Tk의 라디오 버튼 색상 8.5

그럴 수 있습니까? 기본 라디오 버튼을 "상속/확장"하는 자체 위젯을 만들 수 있습니까?

모든 종류의 조언을 환영합니다.

종류와 관련, mefiX

답변

3

radiobutton 명령 -selectcolor 옵션이 있습니다. 이 옵션의 색상을 지정하십시오.

set a 1 
radiobutton .b1 -selectcolor green -variable a -value 1 -text "Option 1" 
radiobutton .b2 -selectcolor green -variable a -value 2 -text "Option 2" 
radiobutton .b3 -selectcolor green -variable a -value 3 -text "Option 3" 
pack .b1 .b2 .b3 

각 라디오 버튼의 색상을 개별적으로 지정하지 않으려는 경우 xresources 데이터베이스에서이 색상을 설정할 수 있습니다.

option add *Radiobutton.selectColor green 
set a 1 
radiobutton .b1 -variable a -value 1 -text "Option 1" 
radiobutton .b2 -variable a -value 2 -text "Option 2" 
radiobutton .b3 -variable a -value 3 -text "Option 3" 
pack .b1 .b2 .b3 

편집 :

ttk::style theme use classic 
ttk::style map TRadiobutton -indicatorcolor {pressed #d9d9d9 selected green} 
set a 1 
ttk::radiobutton .b1 -variable a -value 1 -text "Option 1" 
ttk::radiobutton .b2 -variable a -value 2 -text "Option 2" 
ttk::radiobutton .b3 -variable a -value 3 -text "Option 3" 
pack .b1 .b2 .b3 

당신은 라디오 버튼에 대한 자신 TTK :: 스타일을 정의하고 다시 정의하지 않으려면 특정 위젯을 사용할 수 있습니다 TTK을위한 솔루션 글로벌 스타일 :

ttk::style layout TRadiobuttonGreen [ttk::style layout TRadiobutton] 
ttk::style configure TRadiobuttonGreen {*}[ttk::style configure TRadiobutton] 
ttk::style map TRadiobuttonGreen {*}[ttk::style map TRadiobutton] -indicatorcolor {pressed #d9d9d9 selected green} 

ttk::radiobutton .b1 -style TRadiobuttonGreen -variable a -value 1 -text "Option 1" 
... 

Screenshot

+0

모든 플랫폼에서 작동하지는 않습니다. [JobsianMindTrick]하지만 MacOS X에서 menubuttons의 색상을 바꾸고 싶지는 않습니다. [/ JobsianMindTrick] –

+0

Unforunately, TCL 8.5에서는 나에게 적합하지 않습니다. 또한 Tk 또는 Ttk를 사용 했습니까? – mefiX

+1

@ mefiX ttk 용 솔루션을 추가했습니다. – GrAnd