Define the widget layout for given style. If layoutspec is omitted, return the layout specification for given style. layoutspec is expected to be a list or an object different than None that evaluates to False if you want to "turn off" that style. If it is a list (or
(self, style, layoutspec=None)
| 397 | |
| 398 | |
| 399 | def layout(self, style, layoutspec=None): |
| 400 | """Define the widget layout for given style. If layoutspec is |
| 401 | omitted, return the layout specification for given style. |
| 402 | |
| 403 | layoutspec is expected to be a list or an object different than |
| 404 | None that evaluates to False if you want to "turn off" that style. |
| 405 | If it is a list (or tuple, or something else), each item should be |
| 406 | a tuple where the first item is the layout name and the second item |
| 407 | should have the format described below: |
| 408 | |
| 409 | LAYOUTS |
| 410 | |
| 411 | A layout can contain the value None, if takes no options, or |
| 412 | a dict of options specifying how to arrange the element. |
| 413 | The layout mechanism uses a simplified version of the pack |
| 414 | geometry manager: given an initial cavity, each element is |
| 415 | allocated a parcel. Valid options/values are: |
| 416 | |
| 417 | side: whichside |
| 418 | Specifies which side of the cavity to place the |
| 419 | element; one of top, right, bottom or left. If |
| 420 | omitted, the element occupies the entire cavity. |
| 421 | |
| 422 | sticky: nswe |
| 423 | Specifies where the element is placed inside its |
| 424 | allocated parcel. |
| 425 | |
| 426 | children: [sublayout... ] |
| 427 | Specifies a list of elements to place inside the |
| 428 | element. Each element is a tuple (or other sequence) |
| 429 | where the first item is the layout name, and the other |
| 430 | is a LAYOUT.""" |
| 431 | lspec = None |
| 432 | if layoutspec: |
| 433 | lspec = _format_layoutlist(layoutspec)[0] |
| 434 | elif layoutspec is not None: # will disable the layout ({}, '', etc) |
| 435 | lspec = "null" # could be any other word, but this may make sense |
| 436 | # when calling layout(style) later |
| 437 | |
| 438 | return _list_from_layouttuple(self.tk, |
| 439 | self.tk.call(self._name, "layout", style, lspec)) |
| 440 | |
| 441 | |
| 442 | def element_create(self, elementname, etype, *args, **kw): |