Version 0 of Problems using Tile/Ttk

Updated 2009-05-12 01:00:23 by MG

MG has started this page to list some problems he's been having trying to switch to Tile/Ttk widgets in an app using Tk 8.5. All of the development I'm doing is on Windows XP with a "Classic" Windows look, and I'm hoping someone might be able to help me out with a few of the problems...

My latest hurdle is trying to get coloured buttons. In classic Tk, this is a case of doing:

  button .b -background red

In Tile, I've tried things along the lines of

  ttk::button .b
  1 % ttk::style configure TButton -background red
  2 % ttk::style configure TButton.Button -background red
  3 % ttk::style configure TButton.Button.label -background red

... and so on. Number 1 there has some effect, but not the desired one - I just get a red border around the outside of the button. 2 and 3 (and all kinds of variations, based on the layout elements returned by ttk::style layout TButton) have no effect.

But, if I do #1 and then switch to a different theme from my default (xpnative):

  ttk::setTheme clam

The button changes to a Clam button - and it's red! Now, someone has shown me in the past how I can hack bits out of the clamTheme.tcl file before to basically steal their button for my theme, but that's not hugely helpful - the whole reason I'm trying to switch to Tile is for properly native widgets, and (while the Clam button is a very attractive shape), it's definately not native. (Ironically, on Windows with the Classic look, my red Tk button looks totally native, but I'd like to do this so it works cross-platform, and even on my Win XP system with the "Classic" look turned off, regular Tk buttons stick out.)

So, my question: is there a way to actually get a native looking button, in the color of my choice, no matter the theme I'm using? Or would I be better just admitting defeat here, and sticking with a regular old Tk button, and hoping noone notices that it's different from all the other buttons in my app? This has been driving me mad on and off for months, so any help someone in the know could offer would be greatly appreciated. Thanks for your time.