| 287 | Both options are for use by subclasses only. |
| 288 | """ |
| 289 | def __init__ (self, master=None, widgetName=None, |
| 290 | static_options=None, cnf={}, kw={}): |
| 291 | # Merge keywords and dictionary arguments |
| 292 | if kw: |
| 293 | cnf = _cnfmerge((cnf, kw)) |
| 294 | else: |
| 295 | cnf = _cnfmerge(cnf) |
| 296 | |
| 297 | # Move static options into extra. static_options must be |
| 298 | # a list of keywords (or None). |
| 299 | extra=() |
| 300 | |
| 301 | # 'options' is always a static option |
| 302 | if static_options: |
| 303 | static_options.append('options') |
| 304 | else: |
| 305 | static_options = ['options'] |
| 306 | |
| 307 | for k,v in list(cnf.items()): |
| 308 | if k in static_options: |
| 309 | extra = extra + ('-' + k, v) |
| 310 | del cnf[k] |
| 311 | |
| 312 | self.widgetName = widgetName |
| 313 | self._setup(master, cnf) |
| 314 | |
| 315 | # If widgetName is None, this is a dummy creation call where the |
| 316 | # corresponding Tk widget has already been created by Tix |
| 317 | if widgetName: |
| 318 | self.tk.call(widgetName, self._w, *extra) |
| 319 | |
| 320 | # Non-static options - to be done via a 'config' command |
| 321 | if cnf: |
| 322 | Widget.config(self, cnf) |
| 323 | |
| 324 | # Dictionary to hold subwidget names for easier access. We can't |
| 325 | # use the children list because the public Tix names may not be the |
| 326 | # same as the pathname component |
| 327 | self.subwidget_list = {} |
| 328 | |
| 329 | # We set up an attribute access function so that it is possible to |
| 330 | # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello' |