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

Phil Thompson phil at riverbankcomputing.com
Wed Feb 8 22:53:03 GMT 2012


On Sun, 05 Feb 2012 20:30:22 -0500, Jishnu Das <jd327 at cornell.edu> wrote:
> 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

Have you read...

http://www.riverbankcomputing.com/static/Docs/PyQt4/html/new_style_signals_slots.html#connecting-slots-by-name

Phil


More information about the PyQt mailing list