当前位置: 首页>>代码示例>>Python>>正文


Python win32con.VK_SHIFT属性代码示例

本文整理汇总了Python中win32con.VK_SHIFT属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.VK_SHIFT属性的具体用法?Python win32con.VK_SHIFT怎么用?Python win32con.VK_SHIFT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在win32con的用法示例。


在下文中一共展示了win32con.VK_SHIFT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: click_drag

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def click_drag(x :int, y :int, x2 :int, y2 :int) -> None:
        """Click at pixel xy."""
        x += Window.x
        y += Window.y
        x2 += Window.x
        y2 += Window.y
        lParam = win32api.MAKELONG(x, y)
        lParam2 = win32api.MAKELONG(x2, y2)
        # MOUSEMOVE event is required for game to register clicks correctly
        win32gui.PostMessage(Window.id, wcon.WM_MOUSEMOVE, 0, lParam)
        while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
               win32api.GetKeyState(wcon.VK_SHIFT) < 0 or
               win32api.GetKeyState(wcon.VK_MENU) < 0):
            time.sleep(0.005)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONDOWN,
                             wcon.MK_LBUTTON, lParam)
        time.sleep(userset.LONG_SLEEP * 2)
        win32gui.PostMessage(Window.id, wcon.WM_MOUSEMOVE, 0, lParam2)
        time.sleep(userset.SHORT_SLEEP)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONUP,
                             wcon.MK_LBUTTON, lParam2)
        time.sleep(userset.MEDIUM_SLEEP) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:24,代码来源:inputs.py

示例2: ctrl_click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def ctrl_click(x :int, y :int) -> None:
        """Clicks at pixel x, y while simulating the CTRL button to be down."""
        x += Window.x
        y += Window.y
        lParam = win32api.MAKELONG(x, y)
        while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
               win32api.GetKeyState(wcon.VK_SHIFT) < 0 or
               win32api.GetKeyState(wcon.VK_MENU) < 0):
            time.sleep(0.005)

        win32gui.PostMessage(Window.id, wcon.WM_KEYDOWN, wcon.VK_CONTROL, 0)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONDOWN,
                             wcon.MK_LBUTTON, lParam)
        win32gui.PostMessage(Window.id, wcon.WM_LBUTTONUP,
                             wcon.MK_LBUTTON, lParam)
        win32gui.PostMessage(Window.id, wcon.WM_KEYUP, wcon.VK_CONTROL, 0)
        time.sleep(userset.MEDIUM_SLEEP) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:19,代码来源:inputs.py

示例3: click

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def click(x :int, y :int, button :str ="left", fast :bool =False) -> None:
        """Click at pixel xy."""
        x += Window.x
        y += Window.y
        lParam = win32api.MAKELONG(x, y)
        # MOUSEMOVE event is required for game to register clicks correctly
        win32gui.PostMessage(Window.id, wcon.WM_MOUSEMOVE, 0, lParam)
        while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
               win32api.GetKeyState(wcon.VK_SHIFT) < 0 or
               win32api.GetKeyState(wcon.VK_MENU) < 0):
            time.sleep(0.005)
        if button == "left":
            win32gui.PostMessage(Window.id, wcon.WM_LBUTTONDOWN,
                                 wcon.MK_LBUTTON, lParam)
            win32gui.PostMessage(Window.id, wcon.WM_LBUTTONUP,
                                 wcon.MK_LBUTTON, lParam)
        else:
            win32gui.PostMessage(Window.id, wcon.WM_RBUTTONDOWN,
                                 wcon.MK_RBUTTON, lParam)
            win32gui.PostMessage(Window.id, wcon.WM_RBUTTONUP,
                                 wcon.MK_RBUTTON, lParam)
        # Sleep lower than 0.1 might cause issues when clicking in succession
        if fast:
            time.sleep(userset.FAST_SLEEP)
        else:
            time.sleep(userset.MEDIUM_SLEEP) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:28,代码来源:inputs.py

示例4: send_string

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def send_string(string :str) -> None:
        """Send one or multiple characters to the Window."""
        # Ensure it's a string by converting it to a string
        if isinstance(string, float):
            string = int(string)
        for c in str(string):
            # Make sure no key modifier is pressed
            while (win32api.GetKeyState(wcon.VK_CONTROL) < 0 or
                   win32api.GetKeyState(wcon.VK_SHIFT)   < 0 or
                   win32api.GetKeyState(wcon.VK_MENU)    < 0):
                time.sleep(0.005)
            
            vkc = win32api.VkKeyScan(c)  # Get virtual key code for character c
            # Only one keyup or keydown event needs to be sent
            win32gui.PostMessage(Window.id, wcon.WM_KEYDOWN, vkc, 0) 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:17,代码来源:inputs.py

示例5: fire_key_event

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def fire_key_event(self, msg):
		key = msg[2]
		keyState = 0
		if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000:
			keyState = keyState | win32con.RIGHT_CTRL_PRESSED | win32con.LEFT_CTRL_PRESSED
		if win32api.GetKeyState(win32con.VK_SHIFT) & 0x8000:
			keyState = keyState | win32con.SHIFT_PRESSED
		if win32api.GetKeyState(win32con.VK_MENU) & 0x8000:
			keyState = keyState | win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED
		keyinfo = key, keyState
		# Special hacks for the dead-char key on non-US keyboards.
		# (XXX - which do not work :-(
		event = self.keymap.get( keyinfo )
		if event is None:
##			if key == 220: # Dead key
##				return 1
##			# Translate the raw scancode into an Ascii character.
##			print "translating", key, "(with state)", keyState,
##			key = win32ui.TranslateVirtualKey(key)
##			print "Got back key", `key`,
####			if key is None:
####				return 1 # Dead-key - don't handle at all!!!
##			if key:
##				# Then back to a "normalized" scan-code.
##				key = keycodes.get_scan_code(key[0])
##				keyinfo = key, keyState
##				event = self.keymap.get( keyinfo )
##			if event is None:
				return 1
		return self.fire(event, None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:32,代码来源:bindings.py

示例6: OnFileRun

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def OnFileRun( self, id, code ):
		" Called when a FileRun message is received. "
		import scriptutils
		showDlg = win32api.GetKeyState(win32con.VK_SHIFT) >= 0
		scriptutils.RunScript(None, None, showDlg) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:intpyapp.py

示例7: OnKeyTab

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import VK_SHIFT [as 别名]
def OnKeyTab(self, key):
		if not self.GetDocument().CheckMakeDocumentWritable(): return 0
		start, end = self._obj_.GetSel()
		if start==end:	# normal TAB key
			self.Indent()
			return 0 # we handled this.

		# Otherwise it is a block indent/dedent.
		if start>end:
			start, end = end, start	# swap them.
		startLine = self._obj_.LineFromChar(start)
		endLine = self._obj_.LineFromChar(end)

		self.BlockDent(win32api.GetKeyState(win32con.VK_SHIFT)>=0, startLine, endLine)
		return 0 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:editor.py


注:本文中的win32con.VK_SHIFT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。