[PyQt] Issue with menubar on MacOS X 10.9 and 10.10

Thomas Robitaille thomas.robitaille at gmail.com
Tue Sep 15 19:32:40 BST 2015


Hi everyone,

Just to wrap this up, I finally figured out the issue: in most Python
distributions I've used in the past (e.g. MacPorts or the system
Python on MacOS X) python is the same as pythonw. However, it turns
out that this is not the case in the Anaconda Python Distribution.
Therefore, the issues I was seeing were due to the fact I was running
the example script below with 'python' rather than 'pythonw'. So the
botton line is that if you run scripts that use PyQt with Anaconda,
make sure you run them with 'pythonw'!

Cheers,
Tom


On 15 September 2015 at 11:41, Thomas Robitaille
<thomas.robitaille at gmail.com> wrote:
> Hi Florian,
>
> I have not tried Qt5, but for now using Qt5 is not an option for the
> package I am developing (but I will check if the issue happens
> anyway).
>
> I just did some tests using Qt4 directly without PyQt4 and I cannot
> replicate the issue. The C++ code I used is:
>
> #include <QApplication>
> #include <QMenuBar>
> #include <QMainWindow>
>
> int main(int argc, char *argv[]) {
>   QApplication app(argc, argv);
>   QMainWindow *window = new QMainWindow;
>
>   QMenuBar *menubar = window->menuBar();
>   menubar->addMenu("&File");
>
>   window->show();
>   window->raise();
>   return app.exec();
> }
>
> Basically, whether I compile this on MacOS X 10.10 or compile it on
> MacOS X 10.8 and transfer it to the MacOS X 10.10 machine, I do *not*
> see the issue.
>
> This suggests that this is instead a bug with PyQt4 as opposed to Qt4
> itself. Does anyone know what this could be due to?
>
> Thanks,
> Tom
>
>
>
>
>
>
>
> On 13 September 2015 at 22:31, Florian Bruhin <me at the-compiler.org> wrote:
>> * Thomas Robitaille <thomas.robitaille at gmail.com> [2015-09-13 16:25:13 +0200]:
>>> Hi everyone,
>>>
>>> On MacOS X 10.9 and 10.10 I am seeing buggy behavior with the menubar
>>> in PyQt applications. If I run the following example:
>>>
>>>     from PyQt4.QtGui import QApplication, QMainWindow, QMenu
>>>
>>> [...]
>>
>> Have you tried with PyQt5 yet?
>>
>> Also note that this kind of issues are most likely issues with Qt
>> itself, not with the PyQt bindings - so you might have more luck in
>> general Qt communities.
>>
>> Florian
>>
>> --
>> http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
>>    GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
>>          I love long mails! | http://email.is-not-s.ms/
>>
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list