本文整理汇总了Python中curses.flash方法的典型用法代码示例。如果您正苦于以下问题:Python curses.flash方法的具体用法?Python curses.flash怎么用?Python curses.flash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.flash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flash
# 需要导入模块: import curses [as 别名]
# 或者: from curses import flash [as 别名]
def flash(self):
"""
Flash the screen to indicate that an action was invalid.
"""
if self.config['flash']:
return curses.flash()
else:
return None
示例2: prompt_y_or_n
# 需要导入模块: import curses [as 别名]
# 或者: from curses import flash [as 别名]
def prompt_y_or_n(self, prompt):
"""
Wrapper around prompt_input for simple yes/no queries.
"""
ch = self.prompt_input(prompt, key=True)
if ch in (ord('Y'), ord('y')):
return True
elif ch in (ord('N'), ord('n'), None):
return False
else:
self.flash()
return False
示例3: clear_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import flash [as 别名]
def clear_screen(self):
"""
In the beginning this always called touchwin(). However, a bug
was discovered in tmux when TERM was set to `xterm-256color`, where
only part of the screen got redrawn when scrolling. tmux automatically
sets TERM to `screen-256color`, but many people choose to override
this in their tmux.conf or .bashrc file which can cause issues.
Using clearok() instead seems to fix the problem, with the trade off
of slightly more expensive screen refreshes.
Update: It was discovered that using clearok() introduced a
separate bug for urxvt users in which their screen flashed when
scrolling. Heuristics were added to make it work with as many
configurations as possible. It's still not perfect
(e.g. urxvt + xterm-256color) will screen flash, but it should
work in all cases if the user sets their TERM correctly.
Reference:
https://github.com/tildeclub/ttrv/issues/343
https://github.com/tildeclub/ttrv/issues/323
"""
if self._term != 'xterm-256color':
self.stdscr.touchwin()
else:
self.stdscr.clearok(True)
示例4: clear_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import flash [as 别名]
def clear_screen(self):
"""
In the beginning this always called touchwin(). However, a bug
was discovered in tmux when TERM was set to `xterm-256color`, where
only part of the screen got redrawn when scrolling. tmux automatically
sets TERM to `screen-256color`, but many people choose to override
this in their tmux.conf or .bashrc file which can cause issues.
Using clearok() instead seems to fix the problem, with the trade off
of slightly more expensive screen refreshes.
Update: It was discovered that using clearok() introduced a
separate bug for urxvt users in which their screen flashed when
scrolling. Heuristics were added to make it work with as many
configurations as possible. It's still not perfect
(e.g. urxvt + xterm-256color) will screen flash, but it should
work in all cases if the user sets their TERM correctly.
Reference:
https://github.com/michael-lazar/rtv/issues/343
https://github.com/michael-lazar/rtv/issues/323
"""
if self._term != 'xterm-256color':
self.stdscr.touchwin()
else:
self.stdscr.clearok(True)