Hey Stefan,

Are you sure that is the right syntax to be using?

a = QtGui.QListWidget(self.listCategory.addItems( category))

This is adding your items to and existing list widget from your UI file,
and then creating a new list widget with the None return value. This widget
will then most likely be garbage collected after the function scope ends
because it didn't have a parent.

It is effectively the same as writting:

self.listCategory.addItems(category)
a = QtGui.QListWidget(None)

Because addItems() doesn't return anything. Isn't the first line all you
want? listCategory comes from the name you gave your list widget in Qt
Designer.
On Apr 28, 2014 2:32 AM, "[email protected]" <[email protected]> wrote:

> never mind......
>
>
> a = QtGui.QListWidget(self.listCategory.addItems(category))
>
>
> Sorry for the noise
>
> regards
> stefan
>
>
> On Sunday, April 27, 2014 2:41:39 PM UTC+1, [email protected] wrote:
>>
>> Hi Guys!
>>
>> I'm trying to learn how to use ui files instead of converting the ui
>> files to python all the time. I use Nathan's
>> http://dl.dropboxusercontent.com/u/1633130/PyQt%20tuts/
>> PySide_loadUiType.py (but import it as "uic")
>>
>>
>> # --------------- file called myAwesome.py
>> __uiFile__ = path/ui.ui
>>
>> form_class, base_class = uic.loadUiType(__uiFile__)
>>
>> class AweSome(form_class, base_class):
>>     def __init__(self, parent=None):
>>         super(AweSome, self).__init__(parent)
>>         self.setupUi(self)
>> #---------------------------------------------------------
>>
>> import myAwesome
>> a = myAwesome.AweSome()
>> a.show()
>>
>> So that works and I see my ui. And I can also connect signals to my
>> buttons using
>>
>> self.btnPressMe.connect.clicked(self.btnPressMe_clicked())
>>
>> But how to I populate QListWidgets? I normally get a list using this
>> command.
>>
>> category = [folder for folder in os.listdir(self.ASSETPATH) if
>> os.path.isdir(os.path.join(self.ASSETPATH,folder))]
>>
>> and then use: self.categorys.addItems(category)
>>
>> But how to I use the QtGui.QListWidget.addItems() command now that I
>> import my ui file? Does it make sense? Sorry for the n00b quesiton about
>> this.
>>
>> regards
>> stefan andersson
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/7c0a0efe-0abc-434e-acc1-25a0193d8885%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/7c0a0efe-0abc-434e-acc1-25a0193d8885%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA32di%3Dx4rkZsyTv8U_kgeNoXRBAytxoM_V0L%3DQRMR8i7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to