本文整理汇总了Python中PyQt5.QtCore.Qt.Key_S方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Key_S方法的具体用法?Python Qt.Key_S怎么用?Python Qt.Key_S使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Key_S方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_S [as 别名]
def __init__(self):
super().__init__()
self._handle = ScaleToolHandle.ScaleToolHandle()
self._snap_scale = False
self._non_uniform_scale = False
self._scale_speed = 10
self._drag_length = 0
self._move_up = True
self._shortcut_key = Qt.Key_S
# We use the position of the scale handle when the operation starts.
# This is done in order to prevent runaway reactions (drag changes of 100+)
self._saved_handle_position = None # for non uniform drag
self._scale_sum = 0.0 # a memory for uniform drag with snap scaling
self._last_event = None # type: Optional[Event] # for uniform drag
self._saved_node_positions = [] # type: List[Tuple[SceneNode, Vector]]
self.setExposedProperties(
"ScaleSnap",
"NonUniformScale",
"ObjectWidth",
"ObjectHeight",
"ObjectDepth",
"ScaleX",
"ScaleY",
"ScaleZ"
)
示例2: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_S [as 别名]
def keyPressEvent(self, ev):
#print("Received Key Press Event!! You Pressed: "+ event.text())
if ev.key() == Qt.Key_S:
#print '# ',ev.key()
print(self.data_coord)
sys.stdout.flush()
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_S [as 别名]
def __init__(self, ui):
super().__init__(ui)
self.ui.pushButton_join.clicked.connect(self.joinTraj)
self.ui.pushButton_split.clicked.connect(self.splitTraj)
#SHORTCUTS
self.ui.pushButton_join.setShortcut(QKeySequence(Qt.Key_J))
self.ui.pushButton_split.setShortcut(QKeySequence(Qt.Key_S))
示例4: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_S [as 别名]
def keyPressEvent(self, event):
"""Keyboard press event
Effective key: W, A, S, D, ↑, ↓, ←, →
Press a key on keyboard, the function will get an event, if the condition is met, call the function
run_action().
Args:
event, this argument will get when an event of keyboard pressed occured
"""
key_press = event.key()
# don't need autorepeat, while haven't released, just run once
if not event.isAutoRepeat():
if key_press == Qt.Key_Up: # up
run_action('camup')
elif key_press == Qt.Key_Right: # right
run_action('camright')
elif key_press == Qt.Key_Down: # down
run_action('camdown')
elif key_press == Qt.Key_Left: # left
run_action('camleft')
elif key_press == Qt.Key_W: # W
run_action('forward')
elif key_press == Qt.Key_A: # A
run_action('fwleft')
elif key_press == Qt.Key_S: # S
run_action('backward')
elif key_press == Qt.Key_D: # D
run_action('fwright')
示例5: keyReleaseEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_S [as 别名]
def keyReleaseEvent(self, event):
"""Keyboard released event
Effective key: W,A,S,D, ↑, ↓, ←, →
Release a key on keyboard, the function will get an event, if the condition is met, call the function
run_action().
Args:
event, this argument will get when an event of keyboard release occured
"""
# don't need autorepeat, while haven't pressed, just run once
key_release = event.key()
if not event.isAutoRepeat():
if key_release == Qt.Key_Up: # up
run_action('camready')
elif key_release == Qt.Key_Right: # right
run_action('camready')
elif key_release == Qt.Key_Down: # down
run_action('camready')
elif key_release == Qt.Key_Left: # left
run_action('camready')
elif key_release == Qt.Key_W: # W
run_action('stop')
elif key_release == Qt.Key_A: # A
run_action('fwstraight')
elif key_release == Qt.Key_S: # S
run_action('stop')
elif key_release == Qt.Key_D: # D
run_action('fwstraight')
示例6: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_S [as 别名]
def keyPressEvent(self, event):
print(event.key())
if event.key() == Qt.Key_M:
self.send_flag = False
self.com.write(b"m")
self.send_flag = False
elif event.key() == Qt.Key_Return or event.key()==Qt.Key_Enter:
self.send_flag = False
self.com.write(b"m")
self.send_flag = False
elif event.key() == Qt.Key_N or event.key() == 92:
self.send_flag = False
self.com.write(b"n")
self.send_flag = False
elif event.key() == Qt.Key_Minus:
self.send_flag = False
self.com.write(b"-")
self.send_flag = False
elif event.key() == Qt.Key_Equal:
self.send_flag = False
self.com.write(b"=")
self.send_flag = False
elif event.key() == Qt.Key_W or event.key() == Qt.Key_Up:
self.send_flag = True
self.key.append(b"w")
elif event.key() == Qt.Key_A or event.key() == Qt.Key_Left:
self.send_flag = True
self.key.append(b"a")
elif event.key() == Qt.Key_S or event.key() == Qt.Key_Down:
self.send_flag = True
self.key.append(b"s")
elif event.key() == Qt.Key_D or event.key() == Qt.Key_Right:
self.send_flag = True
self.key.append(b"d")
elif event.key() == Qt.Key_J:
self.send_flag = True
self.key.append(b"j")
elif event.key() == Qt.Key_K:
self.send_flag = True
self.key.append(b"k")
elif event.key() == Qt.Key_Escape:
self.send_flag = False
self.com.write(b"\x03")
elif event.key() == Qt.Key_Control:
self.keyControlPressed = True
elif event.key() == Qt.Key_C:
if self.keyControlPressed:
self.send_flag = False
self.com.write(b"\x03")
# self.key_label.setText(self.key.decode())