[PyKDE] Pythons slots? how?

Frederick Polgardy Jr polgardy at bodacion.com
Wed Sep 4 00:18:00 BST 2002

On Tuesday 03 September 2002 05:10 pm, Burley, Brent wrote:
> class FruitMenu(QPopupMenu):
>     def __init__(self):
>         QPopupMenu.__init__(self)
>         self.insertItem('apple', self, SLOT('apple()'))
>         self.insertItem('orange', self, SLOT('orange()'))
>     def apple(self): print 'apple'
>     def orange(self): print 'orange'

I don't understand.  Why can't you just say:

        self.insertItem('apple', self, self.apple)
        self.insertItem('orange', self, self.orange)

How is that different from connecting to self.handleChoice, as you do below?  
As far as I know, PyQt can take a Python callable anywhere it's appropriate 
to use a receiver and a slot.

Am I wrong?



F R E D E R I C K   P O L G A R D Y   J R.
Bodacion Technologies - A Virtual Media Company
18-3 E Dundee Road - Suite 300 - Barrington, IL 60010
Phone: 847/842.9008 - Fax: 847/842-1731
Web: http://www.bodacion.com

More information about the PyQt mailing list