[PyKDE] QListBox selectedItem()
Michael Andrews
mandrews at mandrews.org
Mon Sep 1 17:02:01 BST 2003
On Mon, 2003-09-01 at 03:06, Derek Fountain wrote:
> Is the QListBox selectedItem() method implemented? At the risk of looking a
> complete newbie, which I am, why does this:
>
> #!/usr/bin/python
>
> import sys
> from qt import *
>
> app=QApplication(sys.argv)
>
> list=QListBox()
> list.insertItem("Item 1")
> list.insertItem("Item 2")
> list.insertItem("Item 3")
>
> list.setSelected( 1, True )
> print list.selectedItem()
>
> app.setMainWidget(list)
> list.show()
> app.exec_loop()
I don't know about setSelected, I typically use setCurrentItem(). Try:
list.setCurrentItem(0)
--
Michael Andrews <mandrews at mandrews.org>
More information about the PyQt
mailing list