Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced content levelIntermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
更豐富的文字 I/O
|
367
insstr w.insstr([y, x, ]s[, attr])
將字串
s
中的字元以屬性
attr
插入(insert)到位於坐標
(x, y)
上的
w
,將文
字行剩餘的部分往右移。移動到超出行結尾外的任何字元都會遺失。如果你
省略
y
x
insstr
會使用
w
目前的游標坐標。如果你省略
attr
insstr
會使
w
目前預設的屬性。在任何情況中,插入字串完畢後,
insstr
會將
w
目前
的游標坐標設為它所插入的字串的第一個字元。
move w.move(y, x)
w
的游標移到給定的坐標
(x, y)
nodelay w.nodelay(flag)
flag
true,就將
w
設為 no-delay(無延遲)模式;若
flag
false,就
w
重設回正常模式。無延遲模式會影響
w.getch
方法。
refresh w.refresh()
更新螢幕上的視窗
w
,讓所有變更在
w
上產生作用。
curses.textpad
模組提供
Textpad
類別,它能讓你支援進階的輸入和文字
編輯。
Textpad class Textpad(window)
建立並回傳類別
Textpad
的一個實體
t
,它包裹了
curses
視窗實體
window
。實
t
有一個經常用到的方法:
t.edit()
讓使用者在
t
所包裹的視窗實體上互動式地編輯其內容。這個編輯工作階段
editing session)支援簡單的、類似 Emacs 的按鍵繫結(key bindings):
一般的字元會覆寫該視窗之前的內容,方向鍵會移動游標 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9789864766819