色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例

瀏覽:5日期:2022-08-01 15:08:09

1、找到python的安裝目錄在python (版本號(hào))libidlelib目錄下

Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例

添加Clearwindow.py文件

源代碼如下:

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_window2) self.text.bind('<<undo>>', self.undo_event) # add='+' doesn’t work def undo_event(self, event): text = self.text text.mark_set('iomark2', 'iomark') text.mark_set('insert2', 'insert') self.editwin.undo.undo_event(event) # fix iomark and insert text.mark_set('iomark', 'iomark2') text.mark_set('insert', 'insert2') text.mark_unset('iomark2') text.mark_unset('insert2') def clear_window2(self, event): # Alternative method # work around the ModifiedUndoDelegator text = self.text text.undo_block_start() 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') text.undo_block_stop() 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、繼續(xù)在當(dāng)前目錄下(python (版本號(hào))libidlelib)打開(kāi)編輯config-extensions.def(IDLE擴(kuò)展配置文件)

Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例

在原文件下添加如下代碼:

[ClearWindow]enable=1enable_editor=0enable_shell=1[ClearWindow_cfgBindings]clear-window=<Control-Key-w>

3、重新啟動(dòng)IDLE,點(diǎn)擊Options,可看到:

Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例

輸入一些代碼

Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例

Ctrl+w

Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例

即可完成清屏?。。?!到此這篇關(guān)于Python3.7.0 Shell添加清屏快捷鍵的實(shí)現(xiàn)示例的文章就介紹到這了,更多相關(guān)Python Shell添加清屏內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 一级a美女毛片 | 欧美91精品久久久久网免费 | 日韩欧美在线综合网高清 | 久久国产精品歌舞团 | 亚洲欧美一区二区三区国产精品 | 欧美一区亚洲二区 | 国产精品免费一区二区三区 | 国产不卡一区二区三区免费视 | 特级毛片全部免费播放a一级 | 欧美一级看片a免费观看 | 一区二区三区亚洲 | 孕妇孕妇aaaaa级毛片视频 | 婷婷尹人香蕉久久天堂 | 成人做爰视频www视频 | 姐姐真漂亮在线视频中文版 | 日本阿v精品视频在线观看 日本阿v视频在线观看高清 | 国内国外精品一区二区 | 二区三区在线观看 | 99视频在线| 欧美国产精品久久 | 91亚洲免费 | 免费大片黄手机在线观看 | 免费毛片视频网站 | 日本a级精品一区二区三区 日本a级毛片免费视频播放 | 国产精品亚洲第一区二区三区 | 亚洲悠悠色综合中文字幕 | 久久精品国产一区 | 国产 magnet| 欧美一级在线观看视频 | 性xxx69xxx视频在线观看 | 成人18免费入口 | 成人免费视频日本 | 在线观看国产一区二三区 | 午夜精品久视频在线观看 | 九九精品免视看国产成人 | 大尺度福利视频奶水在线 | 久久国产影视免费精品 | 最近中文字幕免费视频 | 狼伊千合综网中文 | 欧美成人专区 | 一区二区三区四区免费视频 |