本文整理匯總了Python中AnyQt.QtTest.QTest.keyRelease方法的典型用法代碼示例。如果您正苦於以下問題:Python QTest.keyRelease方法的具體用法?Python QTest.keyRelease怎麽用?Python QTest.keyRelease使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnyQt.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.keyRelease方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: hold_modifiers
# 需要導入模塊: from AnyQt.QtTest import QTest [as 別名]
# 或者: from AnyQt.QtTest.QTest import keyRelease [as 別名]
def hold_modifiers(widget, modifiers):
# use some unexisting key
QTest.keyPress(widget, Qt.Key_F35, modifiers)
try:
yield
finally:
QTest.keyRelease(widget, Qt.Key_F35)
示例2: modifiers
# 需要導入模塊: from AnyQt.QtTest import QTest [as 別名]
# 或者: from AnyQt.QtTest.QTest import keyRelease [as 別名]
def modifiers(self, modifiers):
"""
Context that simulates pressed modifiers
Since QTest.keypress requries pressing some key, we simulate
pressing "BassBoost" that looks exotic enough to not meddle with
anything.
"""
old_modifiers = QApplication.keyboardModifiers()
try:
QTest.keyPress(self.widget, Qt.Key_BassBoost, modifiers)
yield
finally:
QTest.keyRelease(self.widget, Qt.Key_BassBoost, old_modifiers)