Reputation: 2898
I'm trying to run Gooey which requires wxPython via PyCharm on my Mac (Sierra).
I have python and wxPython installed via homebrew
and a virtual environment setup via the "Project Interpreter" preferences in PyCharm. Unfortunately, I'm getting the following error :
This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.
I've seen various discussions of this issue around including : https://wiki.wxpython.org/wxPythonVirtualenvOnMac
Unfortunately, none of the solutions seems to work with my particular setup with PyCharm. Is there some way to specify a Framework build of python via PyCharm?
Upvotes: 3
Views: 1515
Reputation: 41
I've find a workaround for this issue.
Check that you have wxPython installed, try to import wx from Python 3 interpreter.
python3 -c 'import wx; print(wx.version())'
That command returns 4.0.6 osx-cocoa (phoenix) wxWidgets 3.0.5 for me
Test example
import wx
if __name__ == '__main__':
app = wx.App()
window = wx.Frame(None, title="wxPython Frame", size=(300, 200))
panel = wx.Panel(window)
label = wx.StaticText(panel, label="Hello World", pos=(100, 50))
window.Show(True)
app.MainLoop()
Upvotes: 2