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

128 views
Skip to first unread message

Christian O.

unread,
May 17, 2019, 2:43:40 PM5/17/19
to wxPython-dev
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. 

Mike Driscoll

unread,
May 17, 2019, 3:34:09 PM5/17/19
to wxPyth...@googlegroups.com
Have you tried running the script from cmd.exe? I wonder if sublime is somehow preventing it from running correctly.

 

Robin Dunn

unread,
May 17, 2019, 4:02:15 PM5/17/19
to wxPython-dev
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:

Christian O.

unread,
May 17, 2019, 4:14:42 PM5/17/19
to wxPython-dev
@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 <module>
   
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. 

Robin Dunn

unread,
May 17, 2019, 6:11:09 PM5/17/19
to wxPython-dev


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 <module>
   
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
 
Message has been deleted

Christian O.

unread,
May 17, 2019, 7:15:22 PM5/17/19
to wxPython-dev
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

Xaviou

unread,
May 18, 2019, 4:04:09 AM5/18/19
to wxPython-dev
Hi.
There is a small mistake in Robin's post :

The correct command is not
.......python.exe -x "....."
but
.......python.exe -c "......"

Regards
Xav'

Christian O.

unread,
May 18, 2019, 10:55:10 AM5/18/19
to wxPython-dev
Well it finds it, still not sure why It wont show a frame :(
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

Christian O.

unread,
May 18, 2019, 10:55:02 PM5/18/19
to wxPython-dev
I have uninstalled 3.7 and tried using wxPython with 3.6 however I still havnt been able to get a frame to show. 

Nicolas Pinault

unread,
May 19, 2019, 8:27:26 AM5/19/19
to wxPyth...@googlegroups.com
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...@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.
For more options, visit https://groups.google.com/d/optout.

Christian O.

unread,
May 19, 2019, 1:50:46 PM5/19/19
to wxPython-dev
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.

Robin Dunn

unread,
May 20, 2019, 11:09:05 AM5/20/19
to wxPython-dev
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()" 

Nicolas Pinault

unread,
May 20, 2019, 12:47:01 PM5/20/19
to wxPyth...@googlegroups.com
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 ?
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev...@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.

Christian O.

unread,
May 20, 2019, 2:00:32 PM5/20/19
to wxPython-dev
@ 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.

Christian O.

unread,
May 20, 2019, 2:50:58 PM5/20/19
to wxPython-dev


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...

Claudia Frank

unread,
May 20, 2019, 3:37:16 PM5/20/19
to wxPython-dev
 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?

Christian O.

unread,
May 20, 2019, 5:24:20 PM5/20/19
to wxPython-dev
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"],
Reply all
Reply to author
Forward
0 new messages