tobby48 6 年前
父节点
当前提交
8f41af07c1
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9
    1
      src/kr/co/swh/lecture/python/pyqt5/mainwindow3.py

+ 9
- 1
src/kr/co/swh/lecture/python/pyqt5/mainwindow3.py 查看文件

1
 import sys
1
 import sys
2
 from PyQt5.QtWidgets import *
2
 from PyQt5.QtWidgets import *
3
 from PyQt5.QtGui import QIcon
3
 from PyQt5.QtGui import QIcon
4
- 
4
+from PyQt5.QtCore import Qt
5
+
5
 class MyWindow(QWidget):
6
 class MyWindow(QWidget):
6
     def __init__(self):
7
     def __init__(self):
7
         super().__init__()
8
         super().__init__()
14
      
15
      
15
     def initUI(self):
16
     def initUI(self):
16
         self.setWindowTitle(self.title)
17
         self.setWindowTitle(self.title)
18
+        self.setWindowIcon(QIcon('favicon.ico'))
17
         self.setGeometry(self.left, self.top, self.width, self.height)
19
         self.setGeometry(self.left, self.top, self.width, self.height)
20
+        
21
+        self.setAutoFillBackground(True)
22
+        p = self.palette()
23
+        p.setColor(self.backgroundRole(), Qt.darkRed)
24
+        self.setPalette(p)
25
+        
18
         self.show()
26
         self.show()
19
      
27
      
20
 if __name__ == '__main__':
28
 if __name__ == '__main__':