-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard focus on MacOS #66
Comments
Hey, I don't quite follow what the problem is. What is exactly the problem and what platform are you using? |
I launch the application from the terminal and when writing in an input field the text appears in the terminal. So I assumed that there was a problem with the focus. OS is OSX El Capitan 10.11.6. |
I cannot reproduce it. I have tested it flask_app by adding an input box to examples/flask_app/gui/index.html |
Hi r0x0r I've made a pull request with a small Django application that suffers of this problem. There is information about running this app in the pull request. Thank you. |
This issue seems to occur only under virtualenv. Could you verify that this is the case on your machine? |
I'm going to try to use another alternative method to virtualenv and see what happens. |
Any update? |
I've tried using docker and no luck so far. I'm going to use some packaging tool like py2app next week and see how it goes. |
The problem is caused by the Python interpreter supplied by virtualenv. It acts as a command line application and does not properly register a GUI window with OSX. |
Thank you @r0x0r I'm going to check it! |
Updated README with this info. |
This seems to be related as well https://github.com/gldnspud/virtualenv-pythonw-osx/ |
Confirming that with https://github.com/gldnspud/virtualenv-pythonw-osx pywebview works 100%. Thanks! |
BTW, I think this issue should remain open, until it will be solved (possibly by some dependencies). And in README, I don't think the title is appropriate. VirtualEnv is a cause, but I think the title should have the real issue: e.g. "Lack of keyboard events on macos/cocoa". Reading StackOverflow, it is a common problem (in objc), so I assume it is due to some subtle change in pyobjc, or just pywebview not keeping up the new flags, interfaces, etc. I've tried many "solutions", but without luck, and pyobjc examples are designed in a very different way. In any case, forcing QT solves the problem, allowing me to use virtual environment and python 3.6. (which is important for me, because of backend code, and using to processes it is not so clean) |
+1 Still experiencing this issue. ( Python 3.7.4 Mac OSX Mojave 10.14.6 ). All keyboard input is captured by terminal window. |
I confirm I had the same issue trying to run the todos example out of a virtualenv on mac os 10.14.6 (home brewed Python 3.7.5): text was consistently routed to the terminal (even when I detached the process with 'python start.py &' |
I have the same issue running the todos example. Typing in the input field is echoed in the terminal. |
I agree that this should be reopened. At least a check should be added with a descriptive message of the problem. For future conda users - in your environment run |
@danvenn what check do you propose? |
@r0x0r I couldn't tell you the best way, but one way might be to check if an OSX user is inside a venv, then restart using pythonw / python framework. Looks like there has been some discussion and fixes in the matplotlib repo about this issue. (see here) Rough code idea:
|
Hello r0x0r, when trying to type in an input the focus is on the terminal that called the Python application but mouse works perfectly. I tried reading the docs thinking I maybe needed an specific parameter or setting but I'm not sure which one.
My application is a embebed Django web application and this is the main file that create the webview. Here is the call to webview constructor
What I'm doing wrong? Any help is appreciated.
Thank you.
The text was updated successfully, but these errors were encountered: