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


Python QApplication.setAttribute方法代码示例

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


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

示例1: new_figure_manager_given_figure

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setAttribute [as 别名]

def new_figure_manager_given_figure(num, figure):
    """
    Create a new figure manager instance for the given figure.
    """
    canvas = FigureCanvasQTAgg(figure)
    manager = FigureManagerWorkbench(canvas, num)
    return manager


if __name__ == '__main__':
    # testing code
    import numpy as np
    qapp = QApplication([' '])
    qapp.setAttribute(Qt.AA_UseHighDpiPixmaps)
    if hasattr(Qt, 'AA_EnableHighDpiScaling'):
        qapp.setAttribute(Qt.AA_EnableHighDpiScaling, True)

    x = np.linspace(0, 10*np.pi, 1000)
    cx, sx = np.cos(x), np.sin(x)
    fig_mgr_1 = new_figure_manager(1)
    fig1 = fig_mgr_1.canvas.figure
    ax = fig1.add_subplot(111)
    ax.set_title("Test title")
    ax.set_xlabel("$\mu s$")
    ax.set_ylabel("Counts")

    ax.plot(x, cx)
    fig1.show()
    qapp.exec_()
开发者ID:samueljackson92,项目名称:mantid,代码行数:32,代码来源:figuremanager.py

示例2: QApplication

# 需要导入模块: from qtpy.QtWidgets import QApplication [as 别名]
# 或者: from qtpy.QtWidgets.QApplication import setAttribute [as 别名]
    while changed:
        changed = False
        for edge in edges:
            source = edge.node_source
            dest = edge.node_dest
            if source in connected and dest not in connected:
                current.append(dest)
                changed = True
            if dest in connected and source not in connected:
                current.append(source)
                changed = True
        current = indirect
        connected.extend(current)
    return direct, indirect


if __name__ == '__main__':

    import sys

    app = QApplication(sys.argv)
    app.setAttribute(Qt.AA_UseHighDpiPixmaps)

    from glue.core.state import load
    dc = load('links.glu')

    widget = DataGraphWidget(dc)
    widget.show()

    sys.exit(app.exec_())
开发者ID:jzuhone,项目名称:glue,代码行数:32,代码来源:data_graph.py


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