Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ttk::button has ugly grey borders on OS X

830 views
Skip to first unread message

de...@scratters.com

unread,
Sep 29, 2014, 8:45:48 AM9/29/14
to
On OS X with 8.6.1 I'm seeing ugly grey borders around my ttk widgets when they're rendered onto a white background. Example:

http://www.derekfountain.org/misc/borders.png

The combobox has the blue focus border, but you can see the grey, square edged border around both widgets.

How can I get rid of that? Or colour it white? :)

Kevin Walzer

unread,
Sep 29, 2014, 8:51:13 AM9/29/14
to
On 9/29/14, 8:45 AM, de...@scratters.com wrote:
> How can I get rid of that? Or colour it white?

Neither. You are looking at a system-drawn outline--it's part of the
widget.

Best practice for using a ttk:button on OS X is to place it in a
ttk::frame. The same applies to Windows. No outline visible. Any reason
you're not doing that here?

--Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com

de...@scratters.com

unread,
Sep 29, 2014, 9:09:21 AM9/29/14
to
Only that I've never used ttk before and didn't know to do such a thing. The docs are scarce and confusing.

Why would putting it in a ttk frame help with that border?

David Zolli

unread,
Sep 29, 2014, 9:25:14 AM9/29/14
to
Quote: derek wrote on Mon, 29 September 2014 15:09

> Why would putting it in a ttk frame help with that border?

Hi Derek,

It would help because all your app background will be grey, like any native OS X app.

pack [::ttk::frame .tfr] -fill both -expand 1
pack [::ttk::label .tfr.lbl -text "Hello world"] -side top -fill x -expand 1
pack [::ttk::button .tfr.but -text "Quit" -command {exit}] -side top -fill x -expand 1
--
David Zolli - Kroc

de...@scratters.com

unread,
Sep 29, 2014, 9:49:04 AM9/29/14
to
Oh I see, thanks.

My issue is that I have a cross platform application which is supposed to look the same on Linux, Windows and Mac. It's written with traditional Tk widgets, and the main frames and lists of GUI are all white. It looks consistent and good on all platforms.

But ttk widgets have crept in for various reasons. There's no combobox with Tk, for example, and the BWidget one I was using is buggy on multi-screen Macs. So I replaced it with ttk::combobox, but that looks unpleasant with its grey border on the white background.

I guess there's no real solution other to stop mixing the widget sets.

Kevin Walzer

unread,
Sep 29, 2014, 10:16:03 AM9/29/14
to
On 9/29/14, 9:49 AM, de...@scratters.com wrote:
> I guess there's no real solution other to stop mixing the widget sets.

Most likely that's true. If you want to stick with pure Tk, there is an
alternative comboox widget by Bryan Oakley:

http://oakley.clearlight.com/tcl/combobox/

I got a lot of mileage out of this before ttk came along. Very simple,
powerful.

Robert Heller

unread,
Sep 29, 2014, 10:20:52 AM9/29/14
to
At Mon, 29 Sep 2014 06:49:01 -0700 (PDT) de...@scratters.com wrote:

>
> On Monday, 29 September 2014 14:25:14 UTC+1, David Zolli wrote:
> > Quote: derek wrote on Mon, 29 September 2014 15:09
> >=20
> >=20
> >=20
> > > Why would putting it in a ttk frame help with that border?
> >=20
> >=20
> >=20
> > Hi Derek,
> >=20
> >=20
> >=20
> > It would help because all your app background will be grey, like any nati=
> ve OS X app.
> >=20
> >=20
> >=20
> > pack [::ttk::frame .tfr] -fill both -expand 1
> >=20
> > pack [::ttk::label .tfr.lbl -text "Hello world"] -side top -fill x -expan=
> d 1
> >=20
> > pack [::ttk::button .tfr.but -text "Quit" -command {exit}] -side top -fil=
> l x -expand 1
> >=20
> > --=20
> >=20
> > David Zolli - Kroc
>
> Oh I see, thanks.
>
> My issue is that I have a cross platform application which is supposed to l=
> ook the same on Linux, Windows and Mac. It's written with traditional Tk wi=
> dgets, and the main frames and lists of GUI are all white. It looks consist=
> ent and good on all platforms.
>
> But ttk widgets have crept in for various reasons. There's no combobox with=
> Tk, for example, and the BWidget one I was using is buggy on multi-screen =
> Macs. So I replaced it with ttk::combobox, but that looks unpleasant with i=
> ts grey border on the white background.
>
> I guess there's no real solution other to stop mixing the widget sets.

Right. Take the 'plunge' and convert things to all ttk widgets. There are a
*few* widget types not available in the ttk set: message, text, and canvas are
the main ones.

Note: the ttk widgets have a '-style' option and have a binding for
<<ThemeChanged>> event. This allows for wholesale control of the look of the
widgets (things like colors, padding, and so on).

>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

de...@scratters.com

unread,
Sep 29, 2014, 3:16:38 PM9/29/14
to
I tried to update everything to ttk a while back, but it caused all sorts of problems. The widgets aren't just drop in replacements and things broke all over the place. I rapidly gave up on the idea. My project isn't at a point where I can introduce any instabilities.

Brian Oakley's combobox seems a decent solution, so I've used that instead.

Thanks to everyone for the help.
0 new messages