[PyKDE] QListBox selectedItem()

Derek Fountain derekfountain at yahoo.co.uk
Mon Sep 1 09:07:01 BST 2003


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()

spit out this error:

>./listbox_test.py
Traceback (most recent call last):
  File "./listbox_test.py", line 14, in ?
    print list.selectedItem()
AttributeError: selectedItem

I'm running 3.3.2 on SuSE-8.1. That's a bit old these days, but surely 
something this basic should work if I was doing it right?

-- 
> eatapple
core dump




More information about the PyQt mailing list