[PyKDE] Newbie pyQt user needs some slot help

Matthew Flower mattflower at yahoo.com
Thu Apr 27 06:40:02 BST 2000


Hi folks,

I am having a little bit of trouble and perhaps someone is listening out in radio land.  In a
larger python application I am developing, I have a button that tries to bring up a popup menu. 
(Much in the same way that a "Start" button in windows brings up the start menu.

The problem is that I can't seem to get the exec_loop() slot to work.  My push button will make
other slots fire (such as the quit() signal for the application), but it won't pop up the menu.  I
have played with the QObject.Connect statement a lot, but I haven't found a way that it will work.
 (It does work okay if I just call pm.exec_loop())

I transcribed some sample code below:

from qt import *
import sys

App = QApplication(sys.argv)
widg = QWidget()
widg.setGeometry(300,300,100,35)
but = QPushButton("Button", widg)
pm = QPopupMenu()

pm.insertItem("First Item")
pm.insertItem("Second Item")

QObject.connect(but, SIGNAL("clicked()"), pm, SLOT("exec_loop()"))

App.setMainWidget(widg)
widg.show()
App.exec_loop()

Thanks for all your help in advance.

-Matt  (MattFlower at yahoo.com)

__________________________________________________
Do You Yahoo!?
Talk to your friends online and get email alerts with Yahoo! Messenger.
http://im.yahoo.com/




More information about the PyQt mailing list