Unable to get started with wxPython 4 & Python 3 on windows 10

I’ve been trying for to install wxpython but every time I install it with pip:

C:\Users\Christian>pip install wxPython
Collecting wxPython
Using cached https://files.pythonhosted.org/packages/bd/6e/ce469293cf6f7e391c11ec31161a9d6d0f2acffd05da2fb27bb3b3d81d1e/wxPython-4.0.4-cp37-cp37m-win_amd64.whl
Requirement already satisfied: six in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.12.0)
Requirement already satisfied: Pillow in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (6.0.0)
Installing collected packages: wxPython
Successfully installed wxPython-4.0.4

``

I try to run

import wx

app = wx.App()
frame = wx.Frame(parent=None, title=‘Hello World’)
frame.Show()
app.MainLoop()

``

But every time it builds in sublime, no frame/window appears.

I’m not sure what to do. all the guides online just say to use pip to install and have vs 2015 installed.

Have you tried running the script from cmd.exe? I wonder if sublime is somehow preventing it from running correctly.

Also, make sure that the Python being executed by Sublime is the same Python you used when running pip.

Do you see any error messages or tracebacks?

···

Robin

On Friday, May 17, 2019 at 12:34:09 PM UTC-7, mike wrote:

On Fri, May 17, 2019 at 1:43 PM Christian O. christianolienickplourde@gmail.com wrote:

I’ve been trying for to install wxpython but every time I install it with pip:

C:\Users\Christian>pip install wxPython
Collecting wxPython
Using cached https://files.pythonhosted.org/packages/bd/6e/ce469293cf6f7e391c11ec31161a9d6d0f2acffd05da2fb27bb3b3d81d1e/wxPython-4.0.4-cp37-cp37m-win_amd64.whl
Requirement already satisfied: six in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.12.0)
Requirement already satisfied: Pillow in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (6.0.0)
Installing collected packages: wxPython
Successfully installed wxPython-4.0.4

``

I try to run

import wx

app = wx.App()
frame = wx.Frame(parent=None, title=‘Hello World’)
frame.Show()
app.MainLoop()

``

But every time it builds in sublime, no frame/window appears.

I’m not sure what to do. all the guides online just say to use pip to install and have vs 2015 installed.

Have you tried running the script from cmd.exe? I wonder if sublime is somehow preventing it from running correctly.


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Books: Python 101, Python 201: Intermediate Python, wxPython Recipes, Python Interviews

@mike

When I try runnning the script in Python 3.7 Shell for some reason it cant find the module.

Traceback (most recent call last):
File “C:\Users\Christian\Desktop\The Summoning\Test.py”, line 1, in
import wx
ModuleNotFoundError: No module named ‘wx’

``

@ Robin Dunn Im pretty sure it is the same python.

Sublime build file:

“cmd”: [“C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe”, “-u”, “$file”],
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”

``

Environment Path variable:

C:\Users\Christian\AppData\Local\Programs\Python\Python37\Scripts

``

As for error messages I get none from launching the test script in sublime, however I do in Python 3.7 Shell.

···

On Friday, May 17, 2019 at 4:02:15 PM UTC-4, Robin Dunn wrote:

Also, make sure that the Python being executed by Sublime is the same Python you used when running pip.

Do you see any error messages or tracebacks?

Robin

On Friday, May 17, 2019 at 12:34:09 PM UTC-7, mike wrote:

On Fri, May 17, 2019 at 1:43 PM Christian O. christianoli...@gmail.com wrote:

I’ve been trying for to install wxpython but every time I install it with pip:

C:\Users\Christian>pip install wxPython
Collecting wxPython
Using cached https://files.pythonhosted.org/packages/bd/6e/ce469293cf6f7e391c11ec31161a9d6d0f2acffd05da2fb27bb3b3d81d1e/wxPython-4.0.4-cp37-cp37m-win_amd64.whl
Requirement already satisfied: six in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.12.0)
Requirement already satisfied: Pillow in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (6.0.0)
Installing collected packages: wxPython
Successfully installed wxPython-4.0.4

``

I try to run

import wx

app = wx.App()
frame = wx.Frame(parent=None, title=‘Hello World’)
frame.Show()
app.MainLoop()

``

But every time it builds in sublime, no frame/window appears.

I’m not sure what to do. all the guides online just say to use pip to install and have vs 2015 installed.

Have you tried running the script from cmd.exe? I wonder if sublime is somehow preventing it from running correctly.


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Books: Python 101, Python 201: Intermediate Python, wxPython Recipes, Python Interviews

Just to be sure, run these:

C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -m pip install wxPython

C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -x “import wx; print(wx.version())”

···

On Friday, May 17, 2019 at 1:14:42 PM UTC-7, Christian O. wrote:

@mike

When I try runnning the script in Python 3.7 Shell for some reason it cant find the module.

Traceback (most recent call last):
File “C:\Users\Christian\Desktop\The Summoning\Test.py”, line 1, in
import wx
ModuleNotFoundError: No module named ‘wx’

``

@ Robin Dunn Im pretty sure it is the same python.

Sublime build file:

“cmd”: [“C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe”, “-u”, “$file”],
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”

``

Environment Path variable:

C:\Users\Christian\AppData\Local\Programs\Python\Python37\Scripts

``

Robin

Here are the results after running those lines:

C:\Windows\system32>C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -m pip install wxPython
Requirement already satisfied: wxPython in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (4.0.4)

Requirement already satisfied: six in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.12.0)
Requirement already satisfied: Pillow in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (6.0.0)

C:\Windows\system32>C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -x “import wx; print(wx.version())”
C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe: can’t open file ‘import wx; print(wx.version())’: [Errno 2] No such file or directory

``

···

On Friday, May 17, 2019 at 6:11:09 PM UTC-4, Robin Dunn wrote:

On Friday, May 17, 2019 at 1:14:42 PM UTC-7, Christian O. wrote:

@mike

When I try runnning the script in Python 3.7 Shell for some reason it cant find the module.

Traceback (most recent call last):
File “C:\Users\Christian\Desktop\The Summoning\Test.py”, line 1, in
import wx
ModuleNotFoundError: No module named ‘wx’

``

@ Robin Dunn Im pretty sure it is the same python.

Sublime build file:

“cmd”: [“C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe”, “-u”, “$file”],
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”

``

Environment Path variable:

C:\Users\Christian\AppData\Local\Programs\Python\Python37\Scripts

``

Just to be sure, run these:

C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -m pip install wxPython

C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -x “import wx; print(wx.version())”

Robin

Hi.
There is a small mistake in Robin’s post :

The correct command is not
…python.exe -x “…”

``

but
…python.exe -c “…”

``

Regards

Xav’

Well it finds it, still not sure why It wont show a frame :frowning:
C:\Windows\system32>C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -m pip install wxPython
Requirement already satisfied: wxPython in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (4.0.4)
Requirement already satisfied: Pillow in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (6.0.0)
Requirement already satisfied: six in c:\users\christian\appdata\local\programs\python\python37\lib\site-packages (from wxPython) (1.12.0)

C:\Windows\system32>C:\Users\Christian\AppData\Local\Programs\Python\Python37\python.exe -c “import wx; print(wx.version())”
4.0.4 msw (phoenix) wxWidgets 3.0.5

``

···

On Saturday, May 18, 2019 at 4:04:09 AM UTC-4, Xaviou wrote:

Hi.
There is a small mistake in Robin’s post :

The correct command is not
…python.exe -x “…”

``

but
…python.exe -c “…”

``

Regards

Xav’

I have uninstalled 3.7 and tried using wxPython with 3.6 however I still havnt been able to get a frame to show.

What do you get when running "python" from a terminal ?
You should get something like this but with Python 3.7.x

/Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32//
//Type "help", "copyright", "credits" or "license" for more information. //
//>>> //
/

···

Le 19/05/2019 à 04:55, Christian O. a écrit :

I have uninstalled 3.7 and tried using wxPython with 3.6 however I still havnt been able to get a frame to show.
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+unsubscribe@googlegroups.com <mailto:wxPython-dev+unsubscribe@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxPython-dev/72297872-7247-4670-bada-8ea8c24c2790%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

C:\Users\Christian>python

Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32

Type “help”, “copyright”, “credits” or “license” for more information.

···

On Sunday, May 19, 2019 at 8:27:26 AM UTC-4, Nicolas Pinault wrote:

  What do you get when running "python"

from a terminal ?
You should get something like this but with Python 3.7.x

  *`          Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC

v.1900 64 bit (AMD64)] on win32* * Type “help”, “copyright”, “credits” or “license”
for more information. * *>>> `*

  Le 19/05/2019 à 04:55, Christian O. a écrit :
    I have uninstalled 3.7 and tried using wxPython

with 3.6 however I still havnt been able to get a frame to
show.

  You received this message because you are subscribed to the Google

Groups “wxPython-dev” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to wxPyth...@googlegroups.com.

  To view this discussion on the web visit [https://groups.google.com/d/msgid/wxPython-dev/72297872-7247-4670-bada-8ea8c24c2790%40googlegroups.com](https://groups.google.com/d/msgid/wxPython-dev/72297872-7247-4670-bada-8ea8c24c2790%40googlegroups.com?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

Try this with whichever python you are using now:

python.exe -c “import wx; a=wx.App(); wx.Frame(None).Show(); a.MainLoop()”

···

On Saturday, May 18, 2019 at 7:55:02 PM UTC-7, Christian O. wrote:

I have uninstalled 3.7 and tried using wxPython with 3.6 however I still havnt been able to get a frame to show.

So :
- when you type "|pip install wxPython|", you pip is run in a Python 3.7 environment (see your first message).
- when you type "python", Python 3.6 is run.

There is something weird here.

can you add the following 2 lines at the top of your script ?
import sys
print(sys.version)

What does it print ?

···

Le 19/05/2019 à 19:50, Christian O. a écrit :

C:\Users\Christian>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

On Sunday, May 19, 2019 at 8:27:26 AM UTC-4, Nicolas Pinault wrote:

    What do you get when running "python" from a terminal ?
    You should get something like this but with Python 3.7.x

    /Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900
    64 bit (AMD64)] on win32//
    //Type "help", "copyright", "credits" or "license" for more
    information. //
    //>>> //
    /
    Le 19/05/2019 à 04:55, Christian O. a écrit :

    I have uninstalled 3.7 and tried using wxPython with 3.6 however
    I still havnt been able to get a frame to show.
    -- You received this message because you are subscribed to the
    Google Groups "wxPython-dev" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to wxPyth...@googlegroups.com <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/wxPython-dev/72297872-7247-4670-bada-8ea8c24c2790%40googlegroups.com
    <https://groups.google.com/d/msgid/wxPython-dev/72297872-7247-4670-bada-8ea8c24c2790%40googlegroups.com?utm_medium=email&utm_source=footer>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+unsubscribe@googlegroups.com <mailto:wxPython-dev+unsubscribe@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxPython-dev/42034103-4017-410c-a958-ca8221f9bd85%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

@ Robin Dunn It works, So its installed correctly but for some reason it wont build in sublime even though I can get Tk and pyGame Frames to work in sublime for me

@Nicolas Pinault Nothing weird. I tried using 3.6 thinking it would be more stable.

···

On Monday, May 20, 2019 at 11:09:05 AM UTC-4, Robin Dunn wrote:

On Saturday, May 18, 2019 at 7:55:02 PM UTC-7, Christian O. wrote:

I have uninstalled 3.7 and tried using wxPython with 3.6 however I still havnt been able to get a frame to show.

Try this with whichever python you are using now:

python.exe -c “import wx; a=wx.App(); wx.Frame(None).Show(); a.MainLoop()”

UPDATE:

So im not sure why but the build file is the issue.

{
“cmd”: [“C:\Python\Python 3.6.8\python.exe”, “-u”, “$file”],
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”
}

``

I followed the guide here for installing SublimeREPL package When I set build system to the SublimeREPL-Python build settings,

import wx

app = wx.App()
frame = wx.Frame(None)
frame.Show()
app.MainLoop()

``

Launches without issue -_-’ Now im just not sure why my original build settings file with sublime didnt work…

It has been some time since I tested sublime but as far as I remember you need to add

“shell”: “true”

``

to your build file. Maybe give it a try?

That did the trick. I have no idea why wxPython doesnt run without it but Im glad it works, thanks.

Thank you to each user trying to help me.

Make sure your build file has “shell” : “true” when using sublime 3, windows 10 and with python 3 in order to get wxPython to show()
Crazy.

{
“shell”: “true”,
“cmd”: [“python”, “-u”, “$file”],
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“selector”: “source.python”
}

``