本文整理匯總了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