-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdropdown.py
40 lines (30 loc) · 922 Bytes
/
dropdown.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
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os
class combodemo(QWidget):
def __init__(self, parent = None):
super(combodemo, self).__init__(parent)
layout = QHBoxLayout()
self.cb = QComboBox()
f=open("iplist.txt","r")
os.system("rm -f datanodes.txt")
os.system("touch datanodes.txt")
line=f.readlines()
for i in line:
self.cb.addItem(i)
self.cb.currentIndexChanged.connect(self.selectionchange)
layout.addWidget(self.cb)
self.setLayout(layout)
self.setWindowTitle("Select Nodes")
def selectionchange(self,i):
#print self.cb.currentText()
g=open("datanodes.txt","a")
g.write(self.cb.currentText())
def main():
app = QApplication(sys.argv)
ex = combodemo()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()