[Tkinter-discuss] Checkbutton indicatoron ignored on Mac

Kevin Walzer kw at codebykevin.com
Wed Oct 31 16:15:25 CET 2012


On 10/30/12 4:16 PM, Russell E. Owen wrote:
> In article <508FF0E3.5080000 at codebykevin.com>,
>   Kevin Walzer <kw at codebykevin.com> wrote:
>
>> On 10/29/12 4:39 PM, Russell E. Owen wrote:
>>
>>>
>>> It also shows up in tcl (e.g. paste this into wish):
>>> checkbutton .b -text "Foo" -indicatoron 0
>>> pack .b
>>
>> I see the difference here between Tk-Cocoa and 8.4/Carbon. Cocoa does
>> indeed ignore the -indicatoron flag.  Not sure yet if this is a bug that
>> can be fixed or not, but I'll take a closer look at the underlying code.
>
> Thank you.

After looking at the code that implements the checkbutton, it appears 
that, internally, it is mapped to a specific Cocoa button style 
(NSSwitchButton) that does not allow us to turn off the checkmark. I 
suppose we'll have to add this to the list of Tk configuration flags 
that are ignored in certain contexts when Mac-native widgets are used 
(background, relief, etc.).

>>> P.S. While we're on MacOS X bugs, here's another which I also reported
>>> to the Tcl/Tk project: the width of tk_menubutton is wrong on MacOS X
>>> (too narrow by several characters). Here's tcl code for that:
>>>
>>> tk_optionMenu .om omVar DC1 DC2 DC3
>>> .om configure -width 3 # -indicatoron 0
>>> pack .om
>>
>> I see the clipping here, but that can be avoided by adding -fill both
>> -expand yes to the config flags when the menu button is packed. This is
>> probably a function of how Cocoa handles metrics and it may not be
>> something that can be fixed, but I'll see what I can find.
>
> I'm not sure I understand; you are talking about the way the menubutton
> is packed inside the tk_optionMenu widget? Is this something I could
> control in Tkinter?
>

om.pack(fill='both', expand='yes')

--Kevin


More information about the Tkinter-discuss mailing list