This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ttk.Style -- minor issues with element_names and configure
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: claytondarwin, ethan.furman, gpolo, markroseman, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2009-07-22 22:10 by markroseman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ttk_combobox_test.py claytondarwin, 2011-02-22 16:53 Illustrate ttk.Style() issues.
ttk.patch ethan.furman, 2011-09-21 20:24 fix for removing dashes from Style().element_names, and returning None from Style().configure() when setting options. review
ttk_style_fixes.zip ethan.furman, 2011-09-21 22:21 two fixes: elemant_names and configure
issue6549.stoneleaf.01.patch ethan.furman, 2015-02-26 00:56 review
Messages (8)
msg90827 - (view) Author: Mark Roseman (markroseman) * Date: 2009-07-22 22:10
Just a couple of minor things which this terminal session points out


s = ttk.Style()
s.element_options('Button.label')
('-compound', '-space', '-text', '-font', '-foreground', '-underline',
'-width', '-anchor', '-justify', '-wraplength', '-embossed', '-image',
'-stipple', '-background')
s.configure('TButton', font='helvetica 24')
{}
b = ttk.Button(root)
b.configure(text='blah')



The 'element_options' call presumably shouldn't include the dashes, i.e.
'compound' rather than '-compound'

The configure call shouldn't be returning anything, akin to how configuring
a button works.

Again, just little things..
msg90863 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-07-23 20:25
Hi Mark,

I don't think I remember very well where those element options are used.
For instance, where can you use the 'embossed' option ? Would it be only
when using style.configure/style.map with '.' as the style name ?

Knowing that would help to know if the proposed change will affect
something else (and if different/new tests should be added).
msg129094 - (view) Author: Clayton Darwin (claytondarwin) Date: 2011-02-22 16:53
I have been working with the ttk module (Windows XP, Python 3.1) and have encountered some specific issues with ttk.Style() not fully propagating the style into the widget.  In my particular case, there seem to be issues with setting style in TCombobox and TEntry.  The biggest issue is that you can't change the style of the ttk.Combobox popdown.  Style can be set in the top window, but not using all methods, but nothing works for the popdown. 

I have included an example script that illustrates the issues I have encountered.

Clayton
msg129148 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2011-02-23 01:19
> I have been working with the ttk module (Windows XP, Python 3.1) and have encountered some specific issues with ttk.Style() not fully propagating the style into the widget.  In my particular case, there seem to be issues with setting style in TCombobox and TEntry.  The biggest issue is that you can't change the style of the ttk.Combobox popdown.  Style can be set in the top window, but not using all methods, but nothing works for the popdown.

Is this related to the initial report ?

Setting styles may be problematic, and I don't think there is
something fully describing all the things in ttk.Style (Tcl, Python
and other languages) yet. There is a .tcl script that performs a lot
of styling here:
http://tktable.git.sourceforge.net/git/gitweb.cgi?p=tktable/tile-qt;a=tree;f=library;hb=HEAD

It might help you, but I can't confirm. Good luck, but continue this
conversation on a forum if it is not related to the initial report.
msg144390 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2011-09-21 20:24
Not sure what 'embossed' has to do with not having dashes as part of the element option names.

Attached is a patch (hopefully in the right format) agains the current 3.3 sources to remove the dash from the names in .element_names(), as well as return None from .configure() when setting options.
msg144396 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2011-09-21 22:21
The changes to Style.configure were not good.  Corrected so the (possibly empty) result is returned when a query is made but not when configuration is set.

Two patches: one for the element_names issue, one for the configure issue.

Question:  Does it ever make sense to do both a query and a configuration update in the same call?  I don't think it is:

--> ttk.Style.configure('TButton', 'relief', relief='sunken'
'raised'
--> s.configure('TButton','relief')
'raised'

Does it make sense to raise an exception in configure if both query_opt and kw specified?
msg236638 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2015-02-26 00:56
Redid patch against current branch, fixing the typos I had in them.

Any reason not to move forward?
msg247019 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-07-21 07:55
New changeset c3fa46d85857 by Ethan Furman in branch 'default':
Close issue6549: minor ttk.Style fixes
https://hg.python.org/cpython/rev/c3fa46d85857
History
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50798
2015-07-21 07:55:59ethan.furmansetversions: + Python 3.5, - Python 2.7, Python 3.2, Python 3.3
2015-07-21 07:55:20python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg247019

resolution: fixed
stage: patch review -> resolved
2015-02-26 00:56:41ethan.furmansetfiles: + issue6549.stoneleaf.01.patch
nosy: + serhiy.storchaka
messages: + msg236638

2011-09-22 21:52:58terry.reedysetstage: patch review
versions: + Python 3.2, Python 3.3, - Python 3.1
2011-09-22 13:11:05ethan.furmansetnosy: + terry.reedy
2011-09-21 23:17:17ethan.furmansettitle: ttk.Style not translating some Tcl options -> ttk.Style -- minor issues with element_names and configure
2011-09-21 22:21:48ethan.furmansetfiles: + ttk_style_fixes.zip

messages: + msg144396
2011-09-21 20:24:19ethan.furmansetfiles: + ttk.patch

nosy: + ethan.furman
messages: + msg144390

keywords: + patch
2011-02-23 01:19:27gpolosetnosy: gpolo, markroseman, claytondarwin
messages: + msg129148
2011-02-22 16:53:34claytondarwinsetfiles: + ttk_combobox_test.py
nosy: + claytondarwin
messages: + msg129094

2009-07-23 20:25:35gpolosetmessages: + msg90863
versions: + Python 2.7
2009-07-22 22:10:50markrosemancreate