You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
19.4 Rules <strong>for</strong> resource matchingWhen you are creating a widget, and you don’t specify a value <strong>for</strong> some option, and twoor more resource specifications apply to that option, the most specific one applies.For example, suppose your options file has these two lines:*background: LimeGreen*Listbox*background: FloralWhiteBoth specifications apply to the background option in a Listbox widget, but the secondone is more specific, so it will win.In general, the names in a resource specification are a sequence n 1 ; n 2 ; n 3 ; :::; o where eachn i is a class or instance name. The class names are ordered from the highest to the lowestlevel, and o is the name of an option. However, when <strong>Tkinter</strong> is creating a widget, all ithas is the class name and the instance name of that widget.Here are the precedence rules <strong>for</strong> resource specifications:1. The name of the option must match the o part of the option-pattern. For example, ifthe rule isxparrot*indicatoron: 0this will match only options named indicatoron.2. The tight-binding operator (.) is more specific than the loose-binding operator (*).For example, a line <strong>for</strong> *Button.font is more specific than a line <strong>for</strong> *Button*font.3. References to instances are more specific than <strong>reference</strong>s to classes. For example,if you have a button whose instance name is panicButton, a rule <strong>for</strong> *panicButton*fontis more specific than a rule <strong>for</strong> *Button*font.4. A rule with more levels is more specific. For example, a rule <strong>for</strong> *Button*font ismore specific than a rule <strong>for</strong> *font.5. If two rules have same number of levels, names earlier in the list are more specificthan later names. For example, a rule <strong>for</strong> xparrot*font is more specific than a rule<strong>for</strong> *Button*font.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: Standardizing appearance Page 72