-
Notifications
You must be signed in to change notification settings - Fork 0
/
main. py
59 lines (35 loc) · 1.21 KB
/
main. py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/python
import sys
from PyQt5.QtWidgets import QMainWindow, QTextEdit, QAction, QApplication
from PyQt5.QtGui import QIcon, QPixmap, QPainter, QColor
class SVGColorChangeExample(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
textEdit = QTextEdit()
self.setCentralWidget(textEdit)
img = QPixmap("address.svg")
qp = QPainter(img)
qp.setCompositionMode(QPainter.CompositionMode_SourceIn)
# You can enter any color you want here.
qp.fillRect( img.rect(), QColor("white") )
qp.end()
ic = QIcon(img)
adsressAct = QAction(ic, 'Address', self)
adsressAct.triggered.connect(self.close)
self.statusBar()
menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(adsressAct)
toolbar = self.addToolBar('Exit')
toolbar.addAction(adsressAct)
self.setGeometry(300, 300, 350, 250)
self.setWindowTitle('Main window')
self.show()
def main():
app = QApplication(sys.argv)
ex = SVGColorChangeExample()
sys.exit(app.exec_())
if __name__ == '__main__':
main()