Thank you, d_Stranz
On reflection I relise that my previous post was not the best, sorry about that.
Here is my code
#!/usr/bin/env python
import sys
from PyQt4 import QtCore, QtGui
def __init__(self):
super(Window, self).__init__()
self.setGeometry(200,200,700,700)
cb.move(20,40)
tmod = open('list.txt', 'r')
for i in range(4):
cb.addItem(str(i))
tmodel.close()
self.show()
GUI = Window()
sys.exit(app.exec_())
#!/usr/bin/env python
import sys
from PyQt4 import QtCore, QtGui
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setGeometry(200,200,700,700)
cb = QtGui.QComboBox(self)
cb.move(20,40)
tmod = open('list.txt', 'r')
for i in range(4):
cb.addItem(str(i))
tmodel.close()
self.show()
app = QtGui.QApplication(sys.argv)
GUI = Window()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
When I run this code I get the numbers 0 - 3 in the combobox. The list contains name eg Bob Sue etc
In my first post I identified a different senerio in part i solved that by putting the 'str' in this line of code
cb.addItem(str(i))
cb.addItem(str(i))
To copy to clipboard, switch view to plain text mode
.
And I used the range(4) for testing, and that there are only 4 items in the file, I have not figured out what to put there
Thank you for your help
Bookmarks