Tk Source Code

View Ticket
Login
2008-12-28
03:02 Closed ticket [1957190fff]: is "ttk::style element create" specification wrong? plus 3 other changes artifact: fe240069ab user: jenglish
2008-05-06
18:56 Ticket [1957190fff]: 4 changes artifact: a3dc68c4ba user: ggpolo
07:43 Ticket [1957190fff]: 4 changes artifact: bb1f0f4c7a user: nobody
05:29 Ticket [1957190fff]: 4 changes artifact: 829a587923 user: ggpolo
2008-05-04
11:25 New ticket [1957190fff]. artifact: 211dca0e2c user: ggpolo

Ticket UUID: 1957190
Title: is "ttk::style element create" specification wrong?
Type: Bug Version: obsolete: 8.5.2
Submitter: ggpolo Created on: 2008-05-04 11:25:14
Subsystem: 88. Themed Tk Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-12-28 03:02:29
Resolution: Later Closed By: jenglish
    Closed on: 2008-12-27 20:02:29
Description:
Hi,

According to the docs, ttk::style element create is supposed to work like this:

  ttk::style element create elementName type ?args...?

But then checking ttk.test at tk source package, I noticed it accepts this too:

  ttk::style element create plain.background from default

And doing this:

  ttk::style element create plain.background from

Returns me:

  wrong # args: should be "theme ?element?"

Which confuses me even more, because I was expecting a return like: wrong # args: should be "ttk::style element  create name type ?options...?". 
Does "plain.background from default" do something especial ? Does it return something that is then used by ttk::style element create ? Or is the specification incomplete ?

Thanks
User Comments: ggpolo added on 2008-05-06 18:56:31:
Logged In: YES 
user_id=1768847
Originator: YES

Thanks whoever answered, 

And I now I see that my question regarding ttk::style configure was wrong, I should be using ttk::style element options.

nobody@63.205.238.254 added on 2008-05-06 07:43:41:
Logged In: NO 

| Anyway, should this feature be documented ?

Yes, it should be documented.

Sorry, it's not documented yet.

I'll try to explain: "[style element create $elementName $type ..."] calls an "element constructor" (identified by $type) to create a new element named $elementName.

"image" is one of the element constructors (see the manpage, this one is documented).

"from" is another element constructor (this one is not documented, but it should be).  The "from" element constructor just makes $elementName an alias for another element in a different theme.

ggpolo added on 2008-05-06 05:29:48:
Logged In: YES 
user_id=1768847
Originator: YES

I took a look into ttkTheme.c and noticed that when "ttk::style element create" is used like "ttk::style element create somename from sometheme optionalelement" it clones the element, for some definition of cloning. If I do, for example, "ttk::style element create MyNewButton from default TButton", shouldn't MyNewButton inherit all the options from TButton which would then be displayed by "ttk::style configure" (it shows me nothing) ?

Anyway, should this feature be documented ?