午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

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

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

Python3.7.0 Shell添加清屏快捷鍵的實現(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 (版本號)libidlelib)打開編輯config-extensions.def(IDLE擴(kuò)展配置文件)

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

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

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

3、重新啟動IDLE,點擊Options,可看到:

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

輸入一些代碼

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

Ctrl+w

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

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

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 亚洲区视频 | 一区二区视频在线观看 | 亚洲一区二区影院 | 五月婷婷一区二区 | 欧美一级三级 | 国产不卡在线播放 | 深夜激情影院 | 天天艹夜夜艹 | 3d动漫精品啪啪一区二区免费 | 一级一级黄色片 | 九一毛片 | 久久六六| 国产三级短视频 | 久久黄色视屏 | 亚洲综合国产 | 丰满的亚洲女人毛茸茸 | 国产精品国产精品国产专区不片 | 福利一区二区视频 | 99亚洲精品 | 岛国成人在线 | 亚洲黑丝在线 | aaa一区二区 | 香蕉视频在线免费看 | 亚洲一区二区三区久久久 | 午夜69成人做爰视频 | 成人一级黄色片 | 欧美在线一二三 | 国产粉嫩av | 国产喷水在线观看 | 久久一二区 | 欧美天堂在线 | 97se亚洲国产综合在线 | 亚洲插插| 久久网站视频 | 欧美日韩一区二区区别是什么 | 精品国产精品国产偷麻豆 | 成人免费看片98欧美 | 亚洲第一在线 | 欧美性猛交乱大交 | 欧美色妞网 | 黄色伊人网 |