本文整理汇总了Python中qtpy.QtTest.QTest.mousePress方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.mousePress方法的具体用法?Python QTest.mousePress怎么用?Python QTest.mousePress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.mousePress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mouse_click
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import mousePress [as 别名]
def mouse_click(widget, pos, button=Qt.LeftButton):
QTest.mouseMove(widget, pos)
yield
QTest.mousePress(widget, button, Qt.NoModifier, pos)
yield
QTest.mouseRelease(widget, button, Qt.NoModifier, pos)
yield 0.1
示例2: drag_mouse
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import mousePress [as 别名]
def drag_mouse(widget, from_pos, to_pos):
QTest.mousePress(widget, Qt.LeftButton, Qt.NoModifier, from_pos)
yield
QTest.mouseMove(widget, from_pos)
yield 0.1
QTest.mouseMove(widget, to_pos)
yield 0.1
QTest.mouseRelease(widget, Qt.LeftButton, Qt.NoModifier, to_pos)
yield 0.1
示例3: mouse_trigger_action
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import mousePress [as 别名]
def mouse_trigger_action(self, name, pause=0):
menu = self.get_active_popup_widget()
a, m = self.get_action(name, get_menu=True)
pos = menu.actionGeometry(a).center()
QTest.mouseMove(menu, pos)
yield pause
self.hover_action(name)
QTest.mousePress(menu, Qt.LeftButton, Qt.NoModifier, pos)
yield pause
QTest.mouseRelease(menu, Qt.LeftButton, Qt.NoModifier, pos)