develooper Front page | perl.tcltk | Postings from February 2019

Buttons with icons but without boxes on macOS and Tcl::pTk

Thread Next
welle Ozean via tcltk
February 27, 2019 08:59
Buttons with icons but without boxes on macOS and Tcl::pTk
Message ID:

using Tcl::pTk I want to move from the ttkButton to a plain clickable (png)
icon on gray background. I do not want the icon in a box, which is the
standard rendering of buttons, as far as I understand. This looks very odd
nowadays. At best, the icon should be accompanied by a test, as this
screenshot shows:

On a mailing list I get the following Tcl/Tk answers:

1) If you add -style Toolbutton to the ttk::button, the button will look
flat and modern. Adding "-compound top" will allow to specify both image
and text.

2)  set i1 [image create photo -file icon.png]
     button .b -image $i1 -text Open -compound top -relief flat
     pack .b
    Note that colors for the button widget and/or colors/transparency in
    the png image will need to be adjusted so the icon and the button area
    fit together seamlessly.

No matter how many combinations I tried, I could not achieve my result (I
always had boxes around the icons, so that I think that Tcl::pTk does not
support much tweaking of the buttons. Has I guess this is the simplest way
to display icons on modern interfaces, maybe somebody here has already
achieved this result.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About