當前位置: 首頁>>代碼示例>>Python>>正文


Python Tkinter._default_root方法代碼示例

本文整理匯總了Python中Tkinter._default_root方法的典型用法代碼示例。如果您正苦於以下問題:Python Tkinter._default_root方法的具體用法?Python Tkinter._default_root怎麽用?Python Tkinter._default_root使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tkinter的用法示例。


在下文中一共展示了Tkinter._default_root方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _do_until_timeout

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def _do_until_timeout(self, queue, args):
        rect, color, seconds = args
        if tk._default_root is None:
            Debug.log(3, "Creating new temporary Tkinter root")
            temporary_root = True
            root = tk.Tk()
            root.withdraw()
        else:
            Debug.log(3, "Borrowing existing Tkinter root")
            temporary_root = False
            root = tk._default_root
        image_to_show = self.getBitmapFromRect(*rect)
        app = highlightWindow(root, rect, color, image_to_show, queue)
        app.do_until_timeout(seconds)

    ## Process functions 
開發者ID:glitchassassin,項目名稱:lackey,代碼行數:18,代碼來源:PlatformManagerDarwin.py

示例2: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def __init__(self, title, prompt,
                 initialvalue=None,
                 minvalue = None, maxvalue = None,
                 parent = None):

        if not parent:
            import Tkinter
            parent = Tkinter._default_root

        self.prompt   = prompt
        self.minvalue = minvalue
        self.maxvalue = maxvalue

        self.initialvalue = initialvalue

        Dialog.__init__(self, parent, title) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:18,代碼來源:tkSimpleDialog.py

示例3: begin

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def begin(self):
        self.resetoutput()
        if use_subprocess:
            nosub = ''
            client = self.interp.start_subprocess()
            if not client:
                self.close()
                return False
        else:
            nosub = "==== No Subprocess ===="
        self.write("Python %s on %s\n%s\n%s" %
                   (sys.version, sys.platform, self.COPYRIGHT, nosub))
        self.showprompt()
        import Tkinter
        Tkinter._default_root = None # 03Jan04 KBK What's this?
        return True 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:18,代碼來源:PyShell.py

示例4: _show

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def _show(image, title):
    """Helper for the Image.show method."""

    class UI(tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            tkinter.Label.__init__(self, master, image=self.image,
                                   bg="black", bd=0)

    if not tkinter._default_root:
        raise IOError("tkinter not initialized")
    top = tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack() 
開發者ID:tp4a,項目名稱:teleport,代碼行數:20,代碼來源:ImageTk.py

示例5: begin

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def begin(self):
        self.resetoutput()
        if use_subprocess:
            nosub = ''
            client = self.interp.start_subprocess()
            if not client:
                self.close()
                return False
        else:
            nosub = "==== No Subprocess ===="
        self.write("Python %s on %s\n%s\n%s" %
                   (sys.version, sys.platform, self.COPYRIGHT, nosub))
        self.text.focus_force()
        self.showprompt()
        import Tkinter
        Tkinter._default_root = None # 03Jan04 KBK What's this?
        return True 
開發者ID:nccgroup,項目名稱:Splunking-Crime,代碼行數:19,代碼來源:PyShell.py

示例6: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def __init__(self, title, prompt,
                 initialvalue=None,
                 minvalue = None, maxvalue = None,
                 parent = None, rootx_offset=50, rooty_offset=50):

        if not parent:
            import Tkinter
            parent = Tkinter._default_root

        self.prompt   = prompt
        self.minvalue = minvalue
        self.maxvalue = maxvalue

        self.initialvalue = initialvalue

        Dialog.__init__(self, parent, title, rootx_offset, rooty_offset) 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:18,代碼來源:mytkSimpleDialog.py

示例7: _show

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def _show(image, title):

    class UI(Tkinter.Label):
        def __init__(self, master, im):
            if im.mode == "1":
                self.image = BitmapImage(im, foreground="white", master=master)
            else:
                self.image = PhotoImage(im, master=master)
            Tkinter.Label.__init__(self, master, image=self.image,
                bg="black", bd=0)

    if not Tkinter._default_root:
        raise IOError, "tkinter not initialized"
    top = Tkinter.Toplevel()
    if title:
        top.title(title)
    UI(top, image).pack() 
開發者ID:cineuse,項目名稱:CNCGToolKit,代碼行數:19,代碼來源:ImageTk.py

示例8: highlight

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def highlight(self, rect, color="red", seconds=None):
        """ Simulates a transparent rectangle over the specified ``rect`` on the screen.

        Actually takes a screenshot of the region and displays with a
        rectangle border in a borderless window (due to Tkinter limitations)

        If a Tkinter root window has already been created somewhere else,
        uses that instead of creating a new one.
        """
        if tk._default_root is None:
            Debug.log(3, "Creating new temporary Tkinter root")
            temporary_root = True
            root = tk.Tk()
            root.withdraw()
        else:
            Debug.log(3, "Borrowing existing Tkinter root")
            temporary_root = False
            root = tk._default_root
        image_to_show = self.getBitmapFromRect(*rect)
        app = highlightWindow(root, rect, color, image_to_show)
        if seconds == 0:
            t = threading.Thread(target=app.do_until_timeout)
            t.start()
            return app
        app.do_until_timeout(seconds)
        

    ## Process functions 
開發者ID:glitchassassin,項目名稱:lackey,代碼行數:30,代碼來源:PlatformManagerWindows.py

示例9: setup_master

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def setup_master(master=None):
    """If master is not None, itself is returned. If master is None,
    the default master is returned if there is one, otherwise a new
    master is created and returned.

    If it is not allowed to use the default root and master is None,
    RuntimeError is raised."""
    if master is None:
        if Tkinter._support_default_root:
            master = Tkinter._default_root or Tkinter.Tk()
        else:
            raise RuntimeError(
                    "No master specified and Tkinter is "
                    "configured to not support default root")
    return master 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:17,代碼來源:ttk.py

示例10: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def __init__(self, root=None, font=None, name=None, exists=False, **options):
        if not root:
            root = Tkinter._default_root
        if font:
            # get actual settings corresponding to the given font
            font = root.tk.splitlist(root.tk.call("font", "actual", font))
        else:
            font = self._set(options)
        if not name:
            name = "font" + str(id(self))
        self.name = name

        if exists:
            self.delete_font = False
            # confirm font exists
            if self.name not in root.tk.call("font", "names"):
                raise Tkinter._tkinter.TclError, "named font %s does not already exist" % (self.name,)
            # if font config info supplied, apply it
            if font:
                root.tk.call("font", "configure", self.name, *font)
        else:
            # create new font (raises TclError if the font exists)
            root.tk.call("font", "create", self.name, *font)
            self.delete_font = True
        # backlinks!
        self._root  = root
        self._split = root.tk.splitlist
        self._call  = root.tk.call 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:30,代碼來源:tkFont.py

示例11: families

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def families(root=None):
    "Get font families (as a tuple)"
    if not root:
        root = Tkinter._default_root
    return root.tk.splitlist(root.tk.call("font", "families")) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:7,代碼來源:tkFont.py

示例12: names

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def names(root=None):
    "Get names of defined fonts (as a tuple)"
    if not root:
        root = Tkinter._default_root
    return root.tk.splitlist(root.tk.call("font", "names"))

# --------------------------------------------------------------------
# test stuff 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:10,代碼來源:tkFont.py

示例13: image_create

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def image_create(self, imgtype, cnf={}, master=None, **kw):
        if not master:
            master = Tkinter._default_root
            if not master:
                raise RuntimeError, 'Too early to create image'
        if kw and cnf: cnf = _cnfmerge((cnf, kw))
        elif kw: cnf = kw
        options = ()
        for k, v in cnf.items():
            if hasattr(v, '__call__'):
                v = self._register(v)
            options = options + ('-'+k, v)
        return master.tk.call(('image', 'create', imgtype,) + options) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:15,代碼來源:Tix.py

示例14: get_tk_root

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def get_tk_root():
    try:
        root = Tkinter._default_root
    except AttributeError:
        # it is possible to disable default root in Tkinter, although
        # I haven't seen people doing it (but apparently someone did it
        # here).
        root = None

    if root is None:
        # create a new master only if there isn't one already
        root = Tkinter.Tk()

    return root 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:16,代碼來源:support.py

示例15: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import _default_root [as 別名]
def __init__(self, root=None, font=None, name=None, exists=False, **options):
        if not root:
            root = Tkinter._default_root
        tk = getattr(root, 'tk', root)
        if font:
            # get actual settings corresponding to the given font
            font = tk.splitlist(tk.call("font", "actual", font))
        else:
            font = self._set(options)
        if not name:
            name = "font" + str(id(self))
        self.name = name

        if exists:
            self.delete_font = False
            # confirm font exists
            if self.name not in tk.splitlist(tk.call("font", "names")):
                raise Tkinter._tkinter.TclError, "named font %s does not already exist" % (self.name,)
            # if font config info supplied, apply it
            if font:
                tk.call("font", "configure", self.name, *font)
        else:
            # create new font (raises TclError if the font exists)
            tk.call("font", "create", self.name, *font)
            self.delete_font = True
        self._tk = tk
        self._split = tk.splitlist
        self._call  = tk.call 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:30,代碼來源:tkFont.py


注:本文中的Tkinter._default_root方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。