You can use the 'Toolbutton' style in place of 'indicatoron' button = Checkbutton(r, text='Test', style='Toolbutton') button.pack()
> On Sunday, March 13, 2011 11:08 PM Peter wrote: > Hi I am struggling to get a good understanding of styles as used in > ttk. I have read the tutorial section on using styles but have not been > able to solve this problem. > > I am attempting to create a Checkbutton with the indicatoron=3Dfalse > option. Using ttk the documentation is clear that you have to create a > custom style to achieve this behaviour. But the only "example" I have > been able to find on the Internet searches is written in Tcl i.e. here > is what I have found (quoted directly): > > Here=92s how you set it up: To achieve the effect of -indicatoron false, > create a new layout that doesn=92t have an indicator: > > style layout Toolbar.TCheckbutton { > Toolbutton.border -children { > Toolbutton.padding -children { > Toolbutton.label > } > } > } > > Then use style map and style default to control the border appearance: > > style default Toolbar.TCheckbutton \ > -relief flat > style map Toolbar.TCheckbutton -relief { > disabled flat > selected sunken > pressed sunken > active raised > > Hopefully somebody else in this group has "done" this and can post > their "solution"? > > Thanks > Peter >> On Sunday, March 20, 2011 8:12 PM Peter wrote: >> Here is what I came up with - hopefully I have understood the process >> correctly and therefore that the comments are correct :-) >> >> I am not sure I have the color of the indicator when it is (de)pressed >> correct, but to my eyes the color 'snow' looks like the same color >> used with a Tkinter Checkbutton with indicatoron=false. >> >> r = Tk() >> >> s = Style() >> >> s.layout('NoIndicator.TCheckbutton', >> [('Checkbutton.border', >> {'children': [('Checkbutton.padding', >> {'children': [('Checkbutton.label', >> {})]})]})]) >> >> checkbutton >> s.theme_settings('default', { >> 'NoIndicator.TCheckbutton': {'configure': {'relief': ''}}}) >> >> behaviour >> s.map('NoIndicator.TCheckbutton', >> relief=[('disabled', 'flat'), >> ('selected', 'sunken'), >> ('pressed', 'sunken'), >> ('active', 'raised'), >> ('!active', 'raised')], >> background=[('selected', 'snow')]) >> >> button = Checkbutton(r, >> text='Test', >> style='NoIndicator.TCheckbutton') >> button.pack() >> >> r.mainloop() -- http://mail.python.org/mailman/listinfo/python-list