Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name
(self, screenName=None, baseName=None, className='Tk',
useTk=True, sync=False, use=None)
| 2513 | _w = '.' |
| 2514 | |
| 2515 | def __init__(self, screenName=None, baseName=None, className='Tk', |
| 2516 | useTk=True, sync=False, use=None): |
| 2517 | """Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will |
| 2518 | be created. BASENAME will be used for the identification of the profile file (see |
| 2519 | readprofile). |
| 2520 | It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME |
| 2521 | is the name of the widget class.""" |
| 2522 | self.master = None |
| 2523 | self.children = {} |
| 2524 | self._tkloaded = False |
| 2525 | # to avoid recursions in the getattr code in case of failure, we |
| 2526 | # ensure that self.tk is always _something_. |
| 2527 | self.tk = None |
| 2528 | if baseName is None: |
| 2529 | import os |
| 2530 | baseName = os.path.basename(sys.argv[0]) |
| 2531 | baseName, ext = os.path.splitext(baseName) |
| 2532 | if ext not in ('.py', '.pyc'): |
| 2533 | baseName = baseName + ext |
| 2534 | interactive = False |
| 2535 | self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) |
| 2536 | if _debug: |
| 2537 | self.tk.settrace(_print_command) |
| 2538 | if useTk: |
| 2539 | self._loadtk() |
| 2540 | if not sys.flags.ignore_environment: |
| 2541 | # Issue #16248: Honor the -E flag to avoid code injection. |
| 2542 | self.readprofile(baseName, className) |
| 2543 | |
| 2544 | def loadtk(self): |
| 2545 | if not self._tkloaded: |
no test coverage detected