繁体   English   中英

新的弹出窗口(Qt4 / PyQt4,Python3)

[英]new pop up window (Qt4 / PyQt4, Python3)

它一定很简单,但是我没有找到解决方法。我有一个带有MainWindow (QMainWindow)的GUI,在其中我通过Qt Designer添加了Help菜单和actionAbout QAction 现在,当我按“帮助”菜单中的“关于”项目时,我想显示一个带有文本“程序...版本...等”的小新窗口。

triggered信号似乎有效,当我按About时出现NotImplementedError 但是现在不知道如何从该信号显示一个新窗口...

class MainWindow(QMainWindow, Ui_MainWindow):
    """
    My main GUI window
    """
    def __init__(self, db, parent = None):
        QMainWindow.__init__(self, parent)
...
    @pyqtSlot(QAction)
    def on_menuAbout_triggered(self, action):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        raise NotImplementedError

好的,这确实很容易:

@pyqtSlot(QAction)
def on_menuAbout_triggered(self, action):
    """
    Show about page
    """
    about_box = QMessageBox(self)
    about_box.about(self, 'About', 'This is a GUI...\n\n<a href="www.google.com">www.google.com</a>')
#        about_box.setText('This is a GUI')
#        about_box.exec()

剩下的就是插入指向页面的链接(此处以google为例)。 上面的示例不起作用。 任何想法如何使文本链接?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM