当前位置: 首页>>代码示例>>Python>>正文


Python WidgetRedirector.WidgetRedirector类代码示例

本文整理汇总了Python中idlelib.WidgetRedirector.WidgetRedirector的典型用法代码示例。如果您正苦于以下问题:Python WidgetRedirector类的具体用法?Python WidgetRedirector怎么用?Python WidgetRedirector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WidgetRedirector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ReadOnlyText

class ReadOnlyText(Text):
    def __init__(self, *args, **kwargs):
        Text.__init__(self, *args, **kwargs)
        self.redirector = WidgetRedirector(self)
        self.insert = \
            self.redirector.register("insert", lambda *args, **kw: "break")
        self.delete = \
            self.redirector.register("delete", lambda *args, **kw: "break")
开发者ID:jaredmixpanel,项目名称:mpexport_py,代码行数:8,代码来源:MPExport.py

示例2: ReadOnlyEntry

class ReadOnlyEntry(Entry):

    def __init__(self, *args, **kwargs):
        Entry.__init__(self, *args, **kwargs)
        self.redirector = WidgetRedirector(self)
        self.insert = self.redirector.register(
            "insert", lambda *args, **kw: "break")
        self.delete = self.redirector.register(
            "delete", lambda *args, **kw: "break")
开发者ID:pblocz,项目名称:programa-pedidos-san-cecilio,代码行数:9,代码来源:hospital_gui_common.py

示例3: ReadOnlyText

class ReadOnlyText(tkinter.Text):
    def __init__(self, *args, **kwargs):
        from idlelib.WidgetRedirector import WidgetRedirector
        tkinter.Text.__init__(self, *args, **kwargs)
        self.redirector = WidgetRedirector(self)
        self.insert = \
            self.redirector.register("insert", lambda *args, **kw: "break")
        self.delete = \
            self.redirector.register("delete", lambda *args, **kw: "break")
开发者ID:gneposis,项目名称:gntools,代码行数:9,代码来源:status.py

示例4: ReadOnlyText

class ReadOnlyText(Tkinter.Text):
    """Sets up a read-only chat box that can be added to with the
    Text.insert method, but cannot be modified by the user because
    all the input is rerouted"""
    def __init__(self, *args, **kwargs):
        Tkinter.Text.__init__(self, *args, **kwargs)
        self.redirector = WidgetRedirector(self)
        self.insert = self.redirector.register(
                                  "insert", lambda *args, **kw: "break")
        self.delete = self.redirector.register(
                                  "delete", lambda *args, **kw: "break")
开发者ID:Timidger,项目名称:Mao,代码行数:11,代码来源:Chat.py

示例5: ReadOnlyText

class ReadOnlyText(tk.Text):
    def __init__(self, *args, **kwargs):
        kwargs['relief'] = tk.FLAT
        kwargs['insertwidth'] = 0
        kwargs['highlightthickness'] = 0
        tk.Text.__init__(self, *args, **kwargs)
        self.redirector = WidgetRedirector(self)
        self.insert = \
            self.redirector.register("insert", lambda *args, **kw: "break")
        self.delete = \
            self.redirector.register("delete", lambda *args, **kw: "break")
开发者ID:boscoh,项目名称:proteomicstools,代码行数:11,代码来源:tkform.py

示例6: __init__

class Percolator:

    def __init__(self, text):
        self.text = text
        self.redir = WidgetRedirector(text)
        self.top = self.bottom = Delegator(text)
        self.bottom.insert = self.redir.register('insert', self.insert)
        self.bottom.delete = self.redir.register('delete', self.delete)
        self.filters = []

    def close(self):
        while self.top is not self.bottom:
            self.removefilter(self.top)

        self.top = None
        self.bottom.setdelegate(None)
        self.bottom = None
        self.redir.close()
        self.redir = None
        self.text = None
        return

    def insert(self, index, chars, tags = None):
        self.top.insert(index, chars, tags)

    def delete(self, index1, index2 = None):
        self.top.delete(index1, index2)

    def insertfilter(self, filter):
        raise isinstance(filter, Delegator) or AssertionError
        raise filter.delegate is None or AssertionError
        filter.setdelegate(self.top)
        self.top = filter
        return

    def removefilter(self, filter):
        if not isinstance(filter, Delegator):
            raise AssertionError
            raise filter.delegate is not None or AssertionError
            f = self.top
            self.top = f is filter and filter.delegate
            filter.setdelegate(None)
        else:
            while not (f.delegate is not filter and f is not self.bottom):
                raise AssertionError
                f.resetcache()
                f = f.delegate

            f.setdelegate(filter.delegate)
            filter.setdelegate(None)
        return
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:51,代码来源:percolator.py

示例7: __init__

class Percolator:

    def __init__(self, text):
        # XXX would be nice to inherit from Delegator
        self.text = text
        self.redir = WidgetRedirector(text)
        self.top = self.bottom = Delegator(text)
        self.bottom.insert = self.redir.register("insert", self.insert)
        self.bottom.delete = self.redir.register("delete", self.delete)
        self.filters = []

    def close(self):
        while self.top is not self.bottom:
            self.removefilter(self.top)
        self.top = None
        self.bottom.setdelegate(None)
        self.bottom = None
        self.redir.close()
        self.redir = None
        self.text = None

    def insert(self, index, chars, tags=None):
        # Could go away if inheriting from Delegator
        self.top.insert(index, chars, tags)

    def delete(self, index1, index2=None):
        # Could go away if inheriting from Delegator
        self.top.delete(index1, index2)

    def insertfilter(self, filter):
        # Perhaps rename to pushfilter()?
        assert isinstance(filter, Delegator)
        assert filter.delegate is None
        filter.setdelegate(self.top)
        self.top = filter

    def removefilter(self, filter):
        # XXX Perhaps should only support popfilter()?
        assert isinstance(filter, Delegator)
        assert filter.delegate is not None
        f = self.top
        if f is filter:
            self.top = filter.delegate
            filter.setdelegate(None)
        else:
            while f.delegate is not filter:
                assert f is not self.bottom
                f.resetcache()
                f = f.delegate
            f.setdelegate(filter.delegate)
            filter.setdelegate(None)
开发者ID:Connor124,项目名称:Gran-Theft-Crop-Toe,代码行数:51,代码来源:Percolator.py

示例8: ReadOnlyText

class ReadOnlyText(ScrolledText):
    def __init__(self, *args, **kwargs):
        ScrolledText.__init__(self, *args, **kwargs)
        self.redirector = WidgetRedirector(self)
        self.insert = self.redirector.register("insert", lambda *args, **kw: "break")
        self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
        self.config(wrap=tk.WORD)
开发者ID:orez-,项目名称:IrcClient,代码行数:7,代码来源:irc_gui.py

示例9: ReadOnlyText

class ReadOnlyText(Text):

    def __init__(self, master=None, cnf={}, **kw):
        super().__init__(master, cnf, **kw)
        self.redirector = WidgetRedirector(self)
        self.insert = self.redirector.register("insert", lambda *args, **kw: "break")
        self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
开发者ID:Greygal,项目名称:EvePlanner,代码行数:7,代码来源:read_only_text.py

示例10: __init__

 def __init__(self, *args, **kwargs):
     Tkinter.Text.__init__(self, *args, **kwargs)
     self.redirector = WidgetRedirector(self)
     self.insert = self.redirector.register(
                               "insert", lambda *args, **kw: "break")
     self.delete = self.redirector.register(
                               "delete", lambda *args, **kw: "break")
开发者ID:Timidger,项目名称:Mao,代码行数:7,代码来源:Chat.py

示例11: __init__

 def __init__(self, *args, **kwargs):
     kwargs["relief"] = tk.FLAT
     kwargs["insertwidth"] = 0
     kwargs["highlightthickness"] = 0
     tk.Text.__init__(self, *args, **kwargs)
     self.redirector = WidgetRedirector(self)
     self.insert = self.redirector.register("insert", lambda *args, **kw: "break")
     self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
开发者ID:boscoh,项目名称:proteomicstools,代码行数:8,代码来源:tkform.py

示例12: __init__

 def __init__(self, text):
     # XXX would be nice to inherit from Delegator
     self.text = text
     self.redir = WidgetRedirector(text)
     self.top = self.bottom = Delegator(text)
     self.bottom.insert = self.redir.register("insert", self.insert)
     self.bottom.delete = self.redir.register("delete", self.delete)
     self.filters = []
开发者ID:0xcc,项目名称:pyston,代码行数:8,代码来源:Percolator.py

示例13: __init__

 def __init__(self, *args, **kwargs):
     tk.Text.__init__(self, *args, **kwargs)
     self.tag_config("ok", foreground="forest green")
     self.tag_config("error", foreground="red")
     self.redir = WidgetRedirector(self)
     self.insert = self.redir.register("insert", lambda *args, **kw: "break")
     self.delete = self.redir.register("delete", lambda *args, **kw: "break")
     self.queue = queue.Queue()
     self.update()
开发者ID:alexandermendes,项目名称:imgverifier,代码行数:9,代码来源:console.py

示例14: ReadOnlyText

 class ReadOnlyText(Text):
     """
     Prevent keys from being shown in the text area.
     We want to control what is actualxpyl presented to the user.
     """
     def __init__(self, *args, **kwargs):
         """
         Trashes every attempt to modify the text area coming from
         user input.
         """
         Text.__init__(self, *args, **kwargs)
         self.redirector = WidgetRedirector(self)
         self.insert = \
             self.redirector.register("insert",
                                      lambda *args, **kw: "break")
         self.delete = \
             self.redirector.register("delete",
                                      lambda *args, **kw: "break")
开发者ID:01org,项目名称:pem,代码行数:18,代码来源:inputrecorder.py

示例15: __init__

    def __init__(self, *args, **kwargs):
        ScrolledText.__init__(self, *args, **kwargs)
        _rc_menu_install(self)
        # overwrite default class binding so we don't need to return "break"
        self.bind_class("Text", "<Control-a>", self.event_select_all)  
        self.bind("<Button-3><ButtonRelease-3>", self.show_menu)

        # Make the widget ready only
        self.redirector = WidgetRedirector(self)
        self.insert = self.redirector.register("insert", lambda *args, **kw: "break")
        self.delete = self.redirector.register("delete", lambda *args, **kw: "break")
开发者ID:IARyan,项目名称:w5c_unlocker,代码行数:11,代码来源:gui_utils.py


注:本文中的idlelib.WidgetRedirector.WidgetRedirector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。