本文整理汇总了Python中win32con.MOUSEEVENTF_RIGHTDOWN属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.MOUSEEVENTF_RIGHTDOWN属性的具体用法?Python win32con.MOUSEEVENTF_RIGHTDOWN怎么用?Python win32con.MOUSEEVENTF_RIGHTDOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.MOUSEEVENTF_RIGHTDOWN属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: button_event
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MOUSEEVENTF_RIGHTDOWN [as 别名]
def button_event(content):
key_table = {'BACKSPACE':8, 'TAB':9, 'TABLE':9, 'CLEAR':12, 'ENTER':13, 'SHIFT':16, 'CTRL':17,
'CONTROL':17, 'ALT':18, 'ALTER':18, 'PAUSE':19, 'BREAK':19, 'CAPSLK':20, 'CAPSLOCK':20, 'ESC':27,
'SPACE':32, 'SPACEBAR':32, 'PGUP':33, 'PAGEUP':33, 'PGDN':34, 'PAGEDOWN':34, 'END':35, 'HOME':36,
'LEFT':37, 'UP':38, 'RIGHT':39, 'DOWN':40, 'SELECT':41, 'PRTSC':42, 'PRINTSCREEN':42, 'SYSRQ':42,
'SYSTEMREQUEST':42, 'EXECUTE':43, 'SNAPSHOT':44, 'INSERT':45, 'DELETE':46, 'HELP':47, 'WIN':91,
'WINDOWS':91, 'F1':112, 'F2':113, 'F3':114, 'F4':115, 'F5':116, 'F6':117, 'F7':118, 'F8':119,
'F9':120, 'F10':121, 'F11':122, 'F12':123, 'F13':124, 'F14':125, 'F15':126, 'F16':127, 'NMLK':144,
'NUMLK':144, 'NUMLOCK':144, 'SCRLK':145, 'SCROLLLOCK':145, 'LEFTCLICK':999, 'RIGHTCLICK':1000}
unrecognized = ''
key_values = []
keys = content.split('+')
for key in keys:
raw_key = key
key = key.strip().replace(' ','').upper()
if key in key_table:
key_values.append(key_table.get(key))
elif len(key) == 1:
key_values.append(ord(key))
else:
if key != '':
unrecognized = raw_key
for key_value in key_values:
if key_value == 999:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
elif key_value == 1000:
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
else:
win32api.keybd_event(key_value, 0, 0, 0)
time.sleep(1)
for i in range(len(key_values)-1, -1, -1):
if key_value == 999:
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
elif key_value == 1000:
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
else:
win32api.keybd_event(key_values[i], 0, win32con.KEYEVENTF_KEYUP, 0)
time.sleep(1)
return unrecognized
#设置开机启动快捷方式
示例2: rmb_down
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MOUSEEVENTF_RIGHTDOWN [as 别名]
def rmb_down():
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0)
示例3: right_click
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MOUSEEVENTF_RIGHTDOWN [as 别名]
def right_click(self, left_offset, top_offset):
pos = self.window.get_box(left_offset, top_offset)
SetCursorPos(pos)
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
# 鼠标左右键同时按下
# left_offset和top_offset表示
# 从左往右第left_offset个,从上往下第top_offset个格子
# 索引从0开始
示例4: left_and_right_click
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MOUSEEVENTF_RIGHTDOWN [as 别名]
def left_and_right_click(self, left_offset, top_offset):
pos = self.window.get_box(left_offset, top_offset)
SetCursorPos(pos)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
# 按下键盘F2