程序图标-importerror: dll load failed: 找不到指定的模块。

时间:2021-06-07 22:42:23
【文件属性】:
文件名称:程序图标-importerror: dll load failed: 找不到指定的模块。
文件大小:915KB
文件格式:PDF
更新时间:2021-06-07 22:42:23
PyQt4指南 1.3程序图标 程序图标就是一个小图片,通常显示在程序标题栏的左上角。在以下的示例中,我们将 学习如何在 PyQt中使用程序图标,另外我们还将学习一些新的方法。 #!/usr/bin/python # icon.py import sys from PyQt4 import QtGui class Icon(QtGui.QWidget): def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.setGeometry(300, 300, 250, 150) self.setWindowTitle('Icon') self.setWindowIcon(QtGui.QIcon('icons/web.png')) app = QtGui.QApplication(sys.argv) icon = Icon() icon.show() sys.exit(app.exec_()) ----------------------------------------------------------------------------------------------------------------- 上一个示例采用了面向过程的方法编写。Python 语言同时支持面向过程和面向对象两 种编程方法。PyQt编程是面向对象的。 class Icon(QtGui.QWidget): def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) 面向对象编程中最重要的是类、属性和方法。以上代码中,我们创建了一个名为 Icon 的新类,该类继承 QtGui.QWidget 类。因此我们必须调用两个构造函数——Icon 的构造函数 www.linuxidc.com Linux公社(LinuxIDC.com) 是包括Ubuntu,Fedora,SUSE技术,最新IT资讯等Linux专业类网站。

网友评论