I need to create a custom style for button widgets which has the same appearance as buttons using the ttk 'clam' theme.
I can set the theme like:
s = ttk.Style()
s.theme_use('clam')
However, given the nature of a theme, this will then set all ttk widgets to use 'clam'.
I would like to be able to set certain ttk buttons to use the clam appearance and others to use default ttk.
I have tried looking at the layouts and configurations of 'TButton' whilst the clam theme is in use but it seems that a theme is a collection of styles and I am unsure on how to 'map' a custom style based on the clam button style.
using this code:
you can egt details about all the layout and config options of the widget. with the native theme on my box (xp) i get this output:
and with the clam theme i get:
note that the clam theme has a
Button.border
element with options, where the native theme has aButton.button
element with no options.you can save the layout from the clam theme (either at write time, or you can get it during run time by loading clam theme, fetch layout then switch theme back and load the layout back in) and use that to style the button.
EDIT in theory this should work:
however for some reason when I do this the text no longer appears on the first button... if i figure it out i'll edit again.