[vtkusers] In OSX vtk window does not get the focus

David Gobbi david.gobbi at gmail.com
Thu Nov 12 19:19:50 EST 2015


It works on Linux is because the focus policy of the window manager is
usually set so that new windows automatically get the focus.

On OS X, I imagine you'd need to get the handle for the NSApplication and
then "activate" it.  I doubt that VTK comes with a built-in way to do it.

 - David



On Thu, Nov 12, 2015 at 4:56 PM, Eleftherios Garyfallidis <
garyfallidis at gmail.com> wrote:

> Hi David,
>
> Thank you for your quick answer.
>
> Just to make something clear here. I am not talking about keyboard focus
> here. The window doesn't take the focus at all. So, what happens is that
> the window appears but it is hidden behind other windows and you need to
> press Command + Tab to try to find the VTK window. The same happens even
> when you use pythonw. After finding the window and click on it then you
> have the keyboard events working.
> As you understand this is frustrating for many of our users because they
> don't get any indication that the application is running.
>
> Also, I am not happy going into the direction of making an application
> bundle because I want to open vtk windows from inside ipython in a module
> like fashion as you do matlplotlib.show().
> And all this works absolutely fine with VTK in Linux. We use vtk
> visualization from inside a python library called Dipy which is  a module
> (a python library) rather than a standalone application. But perhaps there
> is something that I am missing here. Let me know what you think.
>
> Best regards,
> Eleftherios
>
>
>
>
>
> On Thu, Nov 12, 2015 at 5:58 PM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> Hi Eleftherios,
>>
>> On OS X the system python is properly set up to receive keyboard focus,
>> but the anaconda python is not.  In general, in order for a program to
>> receive keyboard events, it must be part of an app bundle, though I'm
>> sure there are exceptions.  I remember that many, many years ago it
>> was necessary to run "pythonw" to get a functional GUI app in python.
>>
>> If you create a bundle for your python program, you can get keyboard
>> events regardless of whose python you use.
>>
>>  - David
>>
>>
>>
>> On Thu, Nov 12, 2015 at 3:32 PM, Eleftherios Garyfallidis <
>> garyfallidis at gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> In OSX using vtk 6 or vtk 5 installed from anaconda the window does not
>>> get the focus.
>>>
>>> This should be trivial to test. You can just run the hello world example
>>> and see it by yourself.
>>> http://www.vtk.org/Wiki/VTK/Examples/Python/Cylinder
>>>
>>> We observed the same issue both with osx 10.9 and 10.11
>>>
>>> Best regards,
>>> Eleftherios
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151112/0bdbc2b9/attachment.html>


More information about the vtkusers mailing list