Buttons with icons but without boxes on macOS and Tcl::pTk
[email protected] (welle Ozean via tcltk) Wed, 27 Feb 2019 08:58:53 +0000
| Newsgroups | perl.tcltk |
|---|---|
| Message-ID | <CAL0NCLtQEF4PDuMbA+9Ltij+CRnSHWqfRSpXYmQtTLa8XDtwvg@mail.gmail.com> |
--0000000000001d93fb0582dc63a4
Content-Type: text/plain; charset="UTF-8"
Hello,
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: https://ibb.co/dfYwKvM
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.
Welle
--0000000000001d93fb0582dc63a4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div>Hello,</div><div><br></div><div>usin=
g Tcl::pTk I want to move from the ttkButton to a plain clickable (png) ico=
n on gray background. I do not want the icon in a box, which is the standar=
d rendering of buttons, as far as I understand. This looks very odd nowaday=
s. At best, the icon should be accompanied by a test, as this screenshot sh=
ows: <a href=3D"https://ibb.co/dfYwKvM" rel=3D"noreferrer" target=3D"_blank=
">https://ibb.co/dfYwKvM</a></div><div><br></div><div>On a mailing list I g=
et the following Tcl/Tk answers:</div><div><br></div><div>1) If you add -st=
yle Toolbutton to the ttk::button, the button will look flat and modern. Ad=
ding "-compound top" will allow to specify both image and text.</=
div><div><br></div><div>2)=C2=A0 set i1 [image create photo -file icon.png]=
<br>=C2=A0 =C2=A0=C2=A0 button .b -image $i1 -text Open -compound top -reli=
ef flat<br>=C2=A0 =C2=A0=C2=A0 pack .b<br>=C2=A0=C2=A0=C2=A0 Note that colo=
rs for the button widget and/or colors/transparency in <br>=C2=A0=C2=A0=C2=
=A0 the png image will need to be adjusted so the icon and the button area =
<br>=C2=A0=C2=A0=C2=A0 fit together seamlessly. <br></div><div><br></div><d=
iv>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 ach=
ieved this result.</div><div><br></div><div>Welle<br></div>
</div></div>
--0000000000001d93fb0582dc63a4--