Python IDLE(shell清屏配置方法)

2021-09-19 23:57:17 字數 3563 閱讀 7319

具體操作如下:

1.複製下面**:

"""

clear window extension

version: 0.2

author: roger d. serwy

[email protected]

date: 2009-06-14

it provides "clear shell window" under "options"

with ability to undo.

add these lines to config-extensions.def

[clearwindow]

enable=1

enable_editor=0

enable_shell=1

[clearwindow_cfgbindings]

clear-window="""

class

clearwindow

: menudefs =[(

'options',[

none,(

'clear shell window'

,'<>'),

]),]

def__init__

(self, editwin)

: self.editwin = editwin

self.text = self.editwin.text

self.text.bind(

"<>"

, self.clear_window2)

self.text.bind(

"<>"

, self.undo_event)

# add="+" doesn't work

defundo_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.新建乙個clearwindow.py檔案,將上面的**儲存到到這個檔案中。

3.找到python的安裝路徑:

電腦找到idle(python ),滑鼠右鍵->屬性

之後進入我的電腦,按照上面的路徑,找到:

開啟lib:

開啟idlelib:

將clearwindow.py檔案放進來

4.用記事本開啟config-extensions.def:

在檔案末尾加上:

[clearwindow]

enable=1

enable_editor=0

enable_shell=1

[clearwindow_cfgbindings]

clear-window=

關閉儲存就行。

開啟python shell,

options下如果出現:clear shell window ctrl + l則配置成功

這時shell清屏就可以用 ctrl + l了

php phpStorm xdebug配置方法

2.配置php.ini,在末尾加上。xdebug zend extension php xdebug 2.3.3 5.6 vc11.dll xdebug.remote enable on xdebug.remote handler dbgp xdebug.remote host localhost ...

ha 配置ssl haproxy ssl 配置方式

haproxy ssl 有兩種方式 1 haproxy 本身提供ssl 證書,後面的web 伺服器走正常的http 2 haproxy 本身只提供 後面的web伺服器https 第一種方式 需要編譯haproxy 支援ssl,編譯引數 make target linux26 use openssl ...

linux tomcat配置https的方法

建立.keystore root centos apache tomcat 6.0.37 keytool genkey alias tomcat keyalg rsa keystore root tomcat apache tomcat 6.0.37 conf keystore 輸入keystore...