forked from pw0300/Qgis_plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialog_1.py
More file actions
59 lines (37 loc) · 1.07 KB
/
dialog_1.py
File metadata and controls
59 lines (37 loc) · 1.07 KB
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
import sys
from PyQt4 import QtGui, QtCore
count = 1
class Main_1(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.initUI()
def initUI(self):
centralwidget = QtGui.QWidget()
self.add = QtGui.QPushButton("Add")
self.add.clicked.connect(self.Add)
self.grid = QtGui.QGridLayout()
self.grid.addWidget(self.add, 0, 0)
centralwidget.setLayout(self.grid)
self.setCentralWidget(centralwidget)
# ---------Window settings --------------------------------
self.setGeometry(300, 300, 280, 170)
self.setWindowTitle("")
self.setWindowIcon(QtGui.QIcon(""))
self.setStyleSheet("background-color:")
self.show()
def Add(self):
global count
b = QtGui.QPushButton(str(count), self)
b.clicked.connect(self.Button)
self.grid.addWidget(b, count, 0)
count += 1
def Button(self):
sender = self.sender()
print(sender.text())
def main():
app = QtGui.QApplication(sys.argv)
main = Main_1()
main.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()