[PyQt] Simple ls -1 /home to QComboBox example

JMiahMan jmiahman at gmail.com
Sun Mar 9 05:58:20 GMT 2008




Simone Zaccarin wrote:
> 
> Perhaps the os.walk(mypath) function in python? This function returns a 
> list of files or directory and interating over that list you can add the 
> items in the combobox.
> 

Sorry bud that didn't work but I found from another poster that
os.listdir('/home') does. I was also able to gleam from this code from
alberto:

>>> import os
>>> mydir = os.listdir('/home')
>>> from PyQt4.QtGui import QApplication, QDialog, QComboBox
>>> app = QApplication([])
>>> dialog = QDialog()
>>> combo = QComboBox(dialog)
>>> from PyQt4.QtCore import QStringList
>>> combo.addItems(QStringList(mydir))
>>> dialog.show()

Which helped out a lot. Thanks a lot for both or your effort and time. I'm
sure I'll have more questions as I'm just learning.

Jeremiah

-- 
View this message in context: http://www.nabble.com/Simple-ls--1--home-to-QComboBox-example-tp15897798p15924146.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list