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


Python QWidget.raise_方法代码示例

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


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

示例1: BoxListView

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import raise_ [as 别名]
                                     numpy.random.randint(0, 255)),
                     dens
                     )
        model.insertRow(model.rowCount(),ll)

        logger.debug("added ".format(ll))
        return ll

    addButton.clicked.connect(addRandomLabel)

    ll=addRandomLabel()
    ll=addRandomLabel()
    ll=addRandomLabel()


    w.show()
    w.raise_()

    tableView = BoxListView()
    l.addWidget(tableView)
    tableView.setModel(model)

    tableView2 = BoxListView()

    tableView2.setModel(model)
    tableView2._table.setShowGrid(True)
    l.addWidget(tableView2)

    ll.density=125
    sys.exit(app.exec_())
开发者ID:DerThorsten,项目名称:ilastik,代码行数:32,代码来源:boxListView.py

示例2: setValueWithoutSignal

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import raise_ [as 别名]
    def setValueWithoutSignal(self, value):
        self._blocksignal = True
        self.setValue(value)
        self._blocksignal = False


if __name__ == "__main__":
    from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout

    app = QApplication([])

    label = QLabel()
    box = DelayedSpinBox(1000)

    def update_label(value):
        print("updating label to: {}".format(value))
        label.setText(str(value))

    box.delayedValueChanged.connect(update_label)

    layout = QVBoxLayout()
    layout.addWidget(label)
    layout.addWidget(box)

    widget = QWidget()
    widget.setLayout(layout)
    widget.show()
    widget.raise_()

    app.exec_()
开发者ID:ilastik,项目名称:volumina,代码行数:32,代码来源:delayedSpinBox.py

示例3: QApplication

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import raise_ [as 别名]
    app = QApplication([])

    mainWindow = QWidget()

    def showShortcuts():
        mgrDlg = ShortcutManagerDlg(mainWindow)
        for (group, name), keyseq in sorted(mgr.get_keyseq_reversemap().items()):
            print(group + "." + name + " : " + keyseq)

    mainLayout = QVBoxLayout()
    btn = QPushButton("Show shortcuts")
    btn.clicked.connect(showShortcuts)
    mainLayout.addWidget(btn)
    mainWindow.setLayout(mainLayout)
    mainWindow.show()
    mainWindow.raise_()

    def trigger(name):
        print("Shortcut triggered:", name)

    ActionInfo = ShortcutManager.ActionInfo

    def registerShortcuts(mgr):
        mgr.register("1", ActionInfo("Group 1", "Shortcut 1A", "Shortcut 1A", partial(trigger, "A"), mainWindow, None))

        mgr.register("2", ActionInfo("Group 1", "Shortcut 1B", "Shortcut 1B", partial(trigger, "B"), mainWindow, None))

        mgr.register("3", ActionInfo("Group 2", "Shortcut 2C", "Shortcut 2C", partial(trigger, "C"), mainWindow, None))

    mgr = ShortcutManager()
    registerShortcuts(mgr)
开发者ID:ilastik,项目名称:volumina,代码行数:33,代码来源:shortcutManagerDlg.py

示例4: TestLayerWidget

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import raise_ [as 别名]

#.........这里部分代码省略.........
    def setUpClass(cls):
        if "TRAVIS" in os.environ:
            # This test fails on Travis-CI for unknown reasons,
            #  probably due to the variability of time.sleep().
            # Skip it on Travis-CI.
            import nose

            raise nose.SkipTest

        #         if threading.currentThread().name == "MainThread":
        #             # Under Qt5, this test fails if we're not running in the main thread.
        #             # This test file needs to be run on it's own, not as part of a test suite with nosetests.
        #             import nose
        #             raise nose.SkipTest

        cls.app = QApplication([])
        cls.errors = False

    @classmethod
    def tearDownClass(cls):
        del cls.app

    def impl(self):
        try:
            # Change the visibility of the *selected* layer
            self.o2.visible = False

            # Make sure the GUI is caught up on paint events
            QApplication.processEvents()

            # We must sleep for the screenshot to be right.
            time.sleep(0.1)

            self.w.repaint()

            screen = QGuiApplication.primaryScreen()

            # Capture the window before we change anything
            beforeImg = screen.grabWindow(self.w.winId()).toImage()

            # Change the visibility of the *selected* layer
            self.o2.visible = True

            self.w.repaint()

            # Make sure the GUI is caught up on paint events
            QApplication.processEvents()

            # We must sleep for the screenshot to be right.
            time.sleep(0.1)

            # Capture the window now that we've changed a layer.
            afterImg = screen.grabWindow(self.w.winId()).toImage()

            # Optional: Save the files so we can inspect them ourselves...
            # beforeImg.save('before.png')
            # afterImg.save('after.png')

            # Before and after should NOT match.
            assert beforeImg != afterImg
        except:
            # Catch all exceptions and print them
            # We must finish so we can quit the app.
            import traceback

            traceback.print_exc()
            TestLayerWidget.errors = True

        qApp.quit()

    def test_repaint_after_visible_change(self):
        self.model = LayerStackModel()

        self.o1 = Layer([])
        self.o1.name = "Fancy Layer"
        self.o1.opacity = 0.5
        self.model.append(self.o1)

        self.o2 = Layer([])
        self.o2.name = "Some other Layer"
        self.o2.opacity = 0.25
        self.model.append(self.o2)

        self.view = LayerWidget(None, self.model)
        self.view.show()
        self.view.updateGeometry()

        self.w = QWidget()
        self.lh = QHBoxLayout(self.w)
        self.lh.addWidget(self.view)
        self.w.setGeometry(100, 100, 300, 300)
        self.w.show()
        self.w.raise_()

        # Run the test within the GUI event loop
        QTimer.singleShot(500, self.impl)
        self.app.exec_()

        # Were there errors?
        assert not TestLayerWidget.errors, "There were GUI errors/failures.  See above."
开发者ID:ilastik,项目名称:volumina,代码行数:104,代码来源:layerwidget_test.py

示例5: show

# 需要导入模块: from PyQt5.QtWidgets import QWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QWidget import raise_ [as 别名]
 def show(self):
     # For non-modal dialogs, show() is not enough to bring the window at the forefront, we have
     # to call raise() as well
     QWidget.showNormal(self)
     QWidget.raise_(self)
     QWidget.activateWindow(self)
开发者ID:daleathan,项目名称:moneyguru,代码行数:8,代码来源:window.py


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