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)
| 2437 | _w = '.' |
| 2438 | |
| 2439 | def __init__(self, screenName=None, baseName=None, className='Tk', |
| 2440 | useTk=True, sync=False, use=None): |
| 2441 | """Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will |
| 2442 | be created. BASENAME will be used for the identification of the profile file (see |
| 2443 | readprofile). |
| 2444 | It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME |
| 2445 | is the name of the widget class.""" |
| 2446 | self.master = None |
| 2447 | self.children = {} |
| 2448 | self._tkloaded = False |
| 2449 | # to avoid recursions in the getattr code in case of failure, we |
| 2450 | # ensure that self.tk is always _something_. |
| 2451 | self.tk = None |
| 2452 | if baseName is None: |
| 2453 | import os |
| 2454 | # TODO: RUSTPYTHON |
| 2455 | # baseName = os.path.basename(sys.argv[0]) |
| 2456 | baseName = "" # sys.argv[0] |
| 2457 | baseName, ext = os.path.splitext(baseName) |
| 2458 | if ext not in ('.py', '.pyc'): |
| 2459 | baseName = baseName + ext |
| 2460 | interactive = False |
| 2461 | self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) |
| 2462 | if _debug: |
| 2463 | self.tk.settrace(_print_command) |
| 2464 | if useTk: |
| 2465 | self._loadtk() |
| 2466 | if not sys.flags.ignore_environment: |
| 2467 | # Issue #16248: Honor the -E flag to avoid code injection. |
| 2468 | self.readprofile(baseName, className) |
| 2469 | |
| 2470 | def loadtk(self): |
| 2471 | if not self._tkloaded: |