Hi,

On Fri, 22 Nov 2019 16:00:07 +0000
Mike Barnett <mike_barn...@hotmail.com> wrote:

> Hmmm... I didn't see am email go out for this.  Did anyone get this
> email?
>

sure :)

> What I am trying to do is "style" ttk widgets in a way that each one
> can have their own unique settings.  I've not found code or pseudo-code
> that does what I'm looking for.
>
> Is it possible for ttk widgets to work like tk widgets in that each can
> have their own unique settings like background color, text color, etc?


You can do this by defining custom styles that inherit their
properties from the widget's default style and set some or other
properties to custom values, as for example:

from tkinter import *
from tkinter import ttk

root=Tk()
style = ttk.Style()
style.configure('my.TButton', background='red')
style.configure('myOther.TButton', background='blue')
ttk.Button(root, style='my.TButton', text='foo').pack()
ttk.Button(root, style='myOther.TButton', text='bar').pack()

root.mainloop()


I hope this helps

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

The games have always strengthened us.  Death becomes a familiar
pattern.  We don't fear it as you do.
                -- Proconsul Marcus Claudius, "Bread and Circuses",
                   stardate 4041.2
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to