本文整理汇总了Python中curses.mousemask方法的典型用法代码示例。如果您正苦于以下问题:Python curses.mousemask方法的具体用法?Python curses.mousemask怎么用?Python curses.mousemask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.mousemask方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _screen_set_mousemask
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def _screen_set_mousemask(self):
curses.mousemask(self._mouse_enabled)
示例2: apply
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def apply():
if not sys.platform.startswith('win32'):
def noop(_):
pass
curses.mousemask = noop
Screen.refresh = ScreenPatch.refresh
示例3: __remove_argument_call_main
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def __remove_argument_call_main(self, screen, enable_mouse=True):
# screen disgarded.
if enable_mouse:
curses.mousemask(curses.ALL_MOUSE_EVENTS)
del screen
return self.main()
示例4: init_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def init_screen():
curses.start_color() # load colors
curses.use_default_colors()
curses.noecho() # do not echo text
curses.cbreak() # do not wait for "enter"
curses.mousemask(curses.ALL_MOUSE_EVENTS)
# Hide cursor, if terminal AND curse supports it
if hasattr(curses, 'curs_set'):
try:
curses.curs_set(0)
except:
pass
示例5: main
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def main(screen):
c.curs_set(0)
c.mousemask(1)
inp = screen.getch()
if inp == c.KEY_MOUSE:
screen.addstr(17, 40, "Mouse is clicked")
screen.refresh()
screen.getch()
time.sleep(10)
示例6: set_mouse_tracking
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def set_mouse_tracking(self, enable=True):
"""
Enable mouse tracking.
After calling this function get_input will include mouse
click events along with keystrokes.
"""
enable = bool(enable)
if enable == self._mouse_tracking_enabled:
return
if enable:
curses.mousemask(0
| curses.BUTTON1_PRESSED | curses.BUTTON1_RELEASED
| curses.BUTTON2_PRESSED | curses.BUTTON2_RELEASED
| curses.BUTTON3_PRESSED | curses.BUTTON3_RELEASED
| curses.BUTTON4_PRESSED | curses.BUTTON4_RELEASED
| curses.BUTTON1_DOUBLE_CLICKED | curses.BUTTON1_TRIPLE_CLICKED
| curses.BUTTON2_DOUBLE_CLICKED | curses.BUTTON2_TRIPLE_CLICKED
| curses.BUTTON3_DOUBLE_CLICKED | curses.BUTTON3_TRIPLE_CLICKED
| curses.BUTTON4_DOUBLE_CLICKED | curses.BUTTON4_TRIPLE_CLICKED
| curses.BUTTON_SHIFT | curses.BUTTON_ALT
| curses.BUTTON_CTRL)
else:
raise NotImplementedError()
self._mouse_tracking_enabled = enable
示例7: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def __init__(self, uncertainty=False):
super(Screen, self).__init__()
self.screen = curses.initscr()
curses.noecho()
curses.mousemask(1)
self.screen.keypad(True)
self.y = 3
self.x = 1
self.offset = 0
self.acs = {}
self.lock_icao = None
self.columns = COLUMNS
if uncertainty:
self.columns.extend(UNCERTAINTY_COLUMNS)
示例8: init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def init_curses(self):
os.environ.setdefault('ESCDELAY', '25')
self.stdscr = curses.initscr()
self.stdscr.clear()
curses.noecho()
curses.curs_set(0)
curses.mousemask(curses.REPORT_MOUSE_POSITION
| curses.BUTTON1_PRESSED | curses.BUTTON1_RELEASED
| curses.BUTTON2_PRESSED | curses.BUTTON2_RELEASED
| curses.BUTTON3_PRESSED | curses.BUTTON3_RELEASED
| curses.BUTTON4_PRESSED | curses.BUTTON4_RELEASED
| curses.BUTTON1_CLICKED | curses.BUTTON3_CLICKED
| curses.BUTTON1_DOUBLE_CLICKED
| curses.BUTTON1_TRIPLE_CLICKED
| curses.BUTTON2_DOUBLE_CLICKED
| curses.BUTTON2_TRIPLE_CLICKED
| curses.BUTTON3_DOUBLE_CLICKED
| curses.BUTTON3_TRIPLE_CLICKED
| curses.BUTTON4_DOUBLE_CLICKED
| curses.BUTTON4_TRIPLE_CLICKED
| curses.BUTTON_SHIFT | curses.BUTTON_ALT
| curses.BUTTON_CTRL)
self.stdscr.keypad(True) # Handle our own escape codes for now
# The first call to getch seems to clobber the statusbar.
# So we make a dummy first call.
self.stdscr.nodelay(True)
self.stdscr.getch()
self.stdscr.nodelay(False)
示例9: setup_mouse
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def setup_mouse(self):
# Mouse support
curses.mouseinterval(10)
if self.app.config["editor"]["use_mouse"]:
curses.mousemask(-1) # All events
else:
curses.mousemask(0) # All events
示例10: setUpCurses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import mousemask [as 别名]
def setUpCurses(self, cursesScreen):
self.cursesScreen = cursesScreen
curses.mousemask(-1)
curses.mouseinterval(0)
# Enable mouse tracking in xterm.
sys.stdout.write('\033[?1002;h')
#sys.stdout.write('\033[?1005;h')
curses.meta(1)
# Access ^c before shell does.
curses.raw()
# Enable Bracketed Paste Mode.
sys.stdout.write('\033[?2004;h')
# Push the escape codes out to the terminal. (Whether this is needed
# seems to vary by platform).
sys.stdout.flush()
try:
curses.start_color()
if not curses.has_colors():
userMessage("This terminal does not support color.")
self.quitNow()
else:
curses.use_default_colors()
except curses.error as e:
app.log.error(e)
app.log.startup(u"curses.COLORS", curses.COLORS)
if 0:
assert curses.COLORS == 256
assert curses.can_change_color() == 1
assert curses.has_colors() == 1
app.log.detail("color_content:")
for i in range(0, curses.COLORS):
app.log.detail("color", i, ": ", curses.color_content(i))
for i in range(16, curses.COLORS):
curses.init_color(i, 500, 500, i * 787 % 1000)
app.log.detail("color_content, after:")
for i in range(0, curses.COLORS):
app.log.detail("color", i, ": ", curses.color_content(i))
if 1:
#rows, cols = self.cursesScreen.getmaxyx()
cursesWindow = self.cursesScreen
cursesWindow.leaveok(1) # Don't update cursor position.
cursesWindow.scrollok(0)
cursesWindow.timeout(10)
cursesWindow.keypad(1)
app.window.mainCursesWindow = cursesWindow