[PyQt] Opening a file dialog in PyQt - possible bug

Jishnu Das jd327 at cornell.edu
Mon Feb 6 01:30:22 GMT 2012


Hello everyone,

I am attaching 2 sample codes - one that doesn't work and another that 
does. There is no apparent reason for the earlier not to work. [The 
third script main.py just defines the interface and is imported in both 
cases.]

core_notworking.py
To illustrate my problem, I have a line-edit (Edt1, has the text 
"Choose") and a pushbutton (Btn1, labelled "Choose"), both of which are 
trying to open a file dialog box. [The other pushbutton is merely to 
quit the application.] In the first case, pressing the return key from 
the line edit does open a file dialog box. The user can then choose the 
file, the name is displayed correctly in the line-edit and the file 
dialog box closes. In the second case, the file dialog box opens and the 
name of the file the user chooses is correctly printed on the 
command-line. However, the file dialog box doesn't close and we seem to 
hit an infinite loop. If we forcibly close the application, the file 
name is lost.

core_working.py
I replicate the situation described above and add @pyqtSlot descriptors 
as described at 
http://www.riverbankcomputing.com/static/Docs/PyQt4/html/new_style_signals_slots.html

I am not sure why omitting the descriptor completely alters the expected 
behavior. It would be great if someone could please help me with this.

Thanks in advance,
Jishnu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: core_working.py
Type: text/x-python-script
Size: 840 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120205/cbd21c88/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core_notworking.py
Type: text/x-python-script
Size: 795 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120205/cbd21c88/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.py
Type: text/x-python-script
Size: 1650 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120205/cbd21c88/attachment-0002.bin>


More information about the PyQt mailing list