Ticket UUID: | b4aa27b1056672b0c78f03132dc7938c72afe64b | |||
Title: | Size and positioning of SVG widget elements | |||
Type: | Bug | Version: | Tk 8.7 | |
Submitter: | kjnash | Created on: | 2023-08-24 13:04:30 | |
Subsystem: | 02. Appearance | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2023-09-02 13:53:00 | |
Resolution: | None | Closed By: | kjnash | |
Closed on: | 2023-09-02 13:53:00 | |||
Description: |
The new SVG scaled widget elements (attached image scaling1-8.7.png) are a great improvement over the old fixed-size elements, which were too small on screens with a high DPI (attached image scaling1-8.6.png). However, there are a couple of issues with the new scaled elements: 1. (At least for my personal taste) the new elements for radiobuttons and checkbuttons are too large. I would prefer them to be about 20% smaller, and not taller than the default font. A possible comparison is with current HTML defaults. 2. If the script tries to adjust [tk scaling], ::tk::scalingPct and ::tk::svgFmt to reduce the size of the checkbox/radiobutton element relative to the text, the element does not remain vertically aligned to the centre of the line of text (attached image scaling2-8.7.png). ==== Note that on X11, reduction of [tk scaling] does not affect the rendering of fonts sized in points (bug [1de3a48312]). The rendering matches [tk scaling] when the latter corresponds to the DPI of the display, which is true for images scaling1-8.6.png and scaling1-8.7.png, but not for scaling2-8.7.png where the scaling was adjusted. Test script: destroy .cb1 .lab image delete {*}[info commands ::tk::icons::indicator*] if {[info exists ::tk::svgFmt]} { set svgValue $::tk::svgFmt } else { set svgValue undefined } . configure -bg green checkbutton .cb1 label .lab -justify left -anchor w .cb1 configure -text [.cb1 cget -font] .lab configure -text "Font [.cb1 cget -font] is: \n -family [font actual [.cb1 cget -font] -family]\n -size [font actual [.cb1 cget -font] -size]\n\[tk scaling\] is: \n [tk scaling]\n\$::tk::svgFmt is: \n $svgValue" pack .lab .cb1 -anchor center -padx 30 -pady 10 | |||
User Comments: |
kjnash added on 2023-09-02 13:53:00:
Hi Csaba, Thanks for the explanation. The new indicators are a great improvement over the old ones (as I already mentioned), and I appreciate the effort you have put into improving Tk. The size of the indicators is a minor detail. I will mark the ticket as closed. Keith. nemethi (claiming to be Csaba Nemethi) added on 2023-09-01 19:52:29: Hi Keith, Regarding the size of the checkbutton and radiobutton indicators: You are right that the whole widget area can be used for toggling. However, there are situations where the widget consists of the indicator only. For example, in a tablelist or ttk::treeview an entire column can contain checkbutton or ttk::checkbutton widgets of which only the indicator is managed. In this case larger indicators are definitely more user-friendly than small ones, especially on touch screens. In addition, modern desktop themes like Adwaita and Yaru on GNOME, or Breeze on KDE use 16x16 indicator images. Some other themes, like Materia use even 18x18 images for their indicators. Hence, Tk's current "native look-and-feel" no longer "conforms to the standards used by everybody else". In Tk 8.7 we have at last the chance to make Tk's overall look more modern, and IMHO this includes also larger indicators than in earlier Tk versions. One more detail: It has been pretty much work to design the SVG images used by Tk 8.7 for the indicators of the Tk core checkbutton and radiobutton widgets on X11 and Windows, as well as for the indicators of the ttk::checkbutton and ttk::radiobutton widgets of the themes alt, clam, and default. The current state is stable and was already presented with success to the Community on various occasions. I consider it as ready for production use. kjnash added on 2023-09-01 16:42:48: Hi Csaba, Thanks for responding. (1) The misalignment was my mistake, and is much less likely to occur with the current trunk. I was using Tk commit [003f186c1c0dbe0] on X11, with the following steps: % tk scaling 1.7367 % set tk::svgFmt {svg -scale 1.25} % source test-script.tcl This commit of Tk does not keep tk::svgFmt in sync with [tk scaling], and so the value must be set by the script. My mistake was to forget to do: % set tk::scalingPct 125 If this step is included, there is no misalignment. Your recent revisions make it unnecessary for user scripts to set tk::svgFmt or tk::scalingPct, which makes mistakes of this kind much less likely. (2) Size of indicators on radiobuttons and checkbuttons. I am not sure that the arguments for large indicators are correct. A ckeckbutton or radiobutton can be activated by clicking/touching anywhere within the widget area: inside the indicator, outside the indicator, or even on the text label. The purpose of the indicator is solely to convey visual information. The clickable area is the entire widget, and if it is too small, the solution is to increase the size of the widget, not only the indicator. I agree that the size of the indicators is a matter of taste. However, when there is no difference in usability, it is better to conform to the standards used by everybody else: in other words to preserve Tk's "native look-and-feel". This would mean using smaller indicators than at present. Keith nemethi (claiming to be Csaba Nemethi) added on 2023-08-29 10:39:11: 1. Whether the new indicators have the proper size is surely also a matter of taste. OTOH, usability is at least as important as the appearance. We had an internal discussion on this subject, and the decisive argument came from Harald Oehlmann: On touch screens larger elements are more user-friendly. 2. At least the variable ::tk::scalingPct is documented to be designed for readonly access, hence adjusting it by user scripts is IMHO no good idea. OTOH, my latest commit (of today) keeps it (together with ::tk::svgFmt) in sync with [tk scaling], hence now the "official" way to adjust these variables is to change Tk's scaling factor via tk scaling. This said, I have tried to reproduce the issue reported by you, but without success. Could you please describe the exact steps that lead to the reported mis-alignment? Your test script just visualizes the result, but I am missing the steps that lead to that result. I have tried to get it both on KDE and GNOME, but for me the indicator remains vertically centered. kjnash added on 2023-08-24 13:36:08: Add a composite of the three test images. |
Attachments:
- side-by-side.png [download] added by kjnash on 2023-08-24 13:34:14. [details]
- scaling2-8.7.png [download] added by kjnash on 2023-08-24 13:07:22. [details]
- scaling1-8.7.png [download] added by kjnash on 2023-08-24 13:06:52. [details]
- scaling1-8.6.png [download] added by kjnash on 2023-08-24 13:06:33. [details]