zoukankan      html  css  js  c++  java
  • python添加清屏功能

    创建文件ClearWindow添加内容

    class ClearWindow:

    menudefs = [

    ('options', [None,

    ('Clear Shell Window', '<<clear-window>>'),

    ]),]

    def __init__(self, editwin):

    self.editwin = editwin

    self.text = self.editwin.text

    self.text.bind("<<clear-window>>", self.clear_window)

    def clear_window2(self, event): # Alternative method

    # work around the ModifiedUndoDelegator

    text = self.text

    text.mark_set("iomark2", "iomark")

    text.mark_set("iomark", 1.0)

    text.delete(1.0, "iomark2 linestart")

    text.mark_set("iomark", "iomark2")

    text.mark_unset("iomark2")

    if self.text.compare('insert', '<', 'iomark'):

    self.text.mark_set('insert', 'end-1c')

    self.editwin.set_line_and_column()

    def clear_window(self, event):

    # remove undo delegator

    undo = self.editwin.undo

    self.editwin.per.removefilter(undo)

    # clear the window, but preserve current command

    self.text.delete(1.0, "iomark linestart")

    if self.text.compare('insert', '<', 'iomark'):

    self.text.mark_set('insert', 'end-1c')

    self.editwin.set_line_and_column()

     # restore undo delegator

    self.editwin.per.insertfilter(undo)

    2.在文件config-extensions.def中末尾添加

    [ClearWindow]

    enable=1

    enable_editor=0

    enable_shell=1

    [ClearWindow_cfgBindings]

    clear-window=<Control-Key-;>

    3.重启idle

  • 相关阅读:
    虚树入门
    378. 骑士放置(最大独立集)
    377. 泥泞的区域(最大点集)
    352. 闇の連鎖
    P2680 运输计划
    Linux下的段错误(Segmentation fault)
    Acwing 98-分形之城
    快速幂 和 快速乘
    P1308-道路修建 (noi 2011)
    洛谷 P1070 道路游戏(noip 2009 普及组 第四题)
  • 原文地址:https://www.cnblogs.com/xpylovely/p/10919262.html
Copyright © 2011-2022 走看看