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"
...
모든 플랫폼에서 작동하지는 않습니다. [JobsianMindTrick]하지만 MacOS X에서 menubuttons의 색상을 바꾸고 싶지는 않습니다. [/ JobsianMindTrick] –
Unforunately, TCL 8.5에서는 나에게 적합하지 않습니다. 또한 Tk 또는 Ttk를 사용 했습니까? – mefiX
@ mefiX ttk 용 솔루션을 추가했습니다. – GrAnd