Tk Source Code

View Ticket
Login
Ticket UUID: e01a250dc8b81497f56f48246e7723ca29a980a5
Title: Tk radiobutton indicator does not change size with font size
Type: Bug Version: 8.6.6
Submitter: anonymous Created on: 2017-09-07 20:05:02
Subsystem: 03. [*button] and [label] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2017-09-18 18:54:20
Resolution: None Closed By: nobody
    Closed on:
Description:
Currently porting an application from 8.4 to 8.6.  Using official builds from Active State, version 8.6.6

The radiobutton command has changed looks - the indicator is a circle now instead of a diamond.  Barring an ability to configure the radio button back to using the original diamond, we'd like the indicator to resize appropriately with the size of the radiobutton itself.  This sample script creates/packs 3 radiobuttons.  In 8.4, the indicator grows to fill the space appropriately, in 8.6 the indicator remains a constant size and frankly looks silly on larger fonts.

set somevar 0
foreach fontsize {6 10 16 24 32} {
  set bname bname$fontsize
  radiobutton .$bname -text "button $bname" -variable somevar -value $bname
  set f [font actual [.$bname cget -font]]
  set newfont [eval font create font$bname $f]
  font configure font$bname -size $fontsize
  .$bname configure -font font$bname
  pack .$bname
}
User Comments: anonymous added on 2017-09-18 18:54:20:
Understood.

That said, in many (non Tk) applications on Windows, when you resize the font, the radio buttons similarly change size.  With that in mind, I think getting Tk radio buttons to behave similarly in Unix and Windows - perhaps the correct solution is making Windows radio buttons to resize - like some radio buttons do on non Tk applications - see Chrome/Mozilla.  

(understood that not all applications resize their radio buttons, e.g. Windows itself does not appear to resize its radio buttons - but their radio buttons are literally twice the size of Tk's (on Linux) and don't look as ridiculous next to the super sized font.  plus, Windows 7 (at least) doesn't allow me to change the font by very much (only 100%, 125%, 150%, 200%), whereas Tk is a general GUI toolkit, and should (in theory) allow me to have some control... just look at the button next to the 32 point font...  but I'm getting on a soap box at this point, sorry)

fvogel added on 2017-09-16 13:46:04:

Oh, and changing this is not just a matter of using butPtr->indicatorDiameter instead of the fixed size, because the image of the indicator is hardcoded in an array.

It looks like having fixed size things was intentional in the change. TIP #109 mentions as its goal to more closely match the Windows side of things. And on Windows the indicator always has the same size regardless of the font size of the text displayed next to it. If so, this is a "Won't fix" ticket.

Perhaps Brian Griffin, the author of TIP #109, can comment?


fvogel added on 2017-09-16 13:20:28:

TIP #109 implemented a new look for checkbutton and radiobutton on Linux (only).

This was committed in 2003 and targeted 8.5, that is... 14 years ago! I have checked that this commit actually is the one that changed the shape of the indicator, and this is the result of an accepted TIP.

It appears that sizing the indicator on the basis of the font size was lost in the process. The code forces the indicator to always be 12 pixels in size.


anonymous added on 2017-09-14 20:16:35:
This is on RH Linux.  6.6

fvogel added on 2017-09-13 19:22:26:
What platform?

On Windows at least I don't see different indicator sizes neither with 8.4 nor with 8.6.

Attachments: