Re: [Tkinter-discuss] ttk styles - is it possible to have one per widget?
Hi, On Fri, 22 Nov 2019 16:00:07 + Mike Barnett 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
Re: [Tkinter-discuss] ttk styles - is it possible to have one per widget?
Hmmm... I didn't see am email go out for this. Did anyone get this email? From: Mike Barnett Sent: Wednesday, November 20, 2019 9:37 PM To: Python-Tkinter Subject: ttk styles - is it possible to have one per widget? I have come back to this problem several times and have asked friends for help, but I never seem to crack this nut. 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? Any code or pointers to pages with some code that I can lift would be awesome as I can't seem to write my own that works. Happy to share the kinds of things I've tried if it would help. Thank you for your time -mike ___ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss
[Tkinter-discuss] ttk styles - is it possible to have one per widget?
I have come back to this problem several times and have asked friends for help, but I never seem to crack this nut. 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? Any code or pointers to pages with some code that I can lift would be awesome as I can't seem to write my own that works. Happy to share the kinds of things I've tried if it would help. Thank you for your time -mike ___ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss