Skip to content
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

[Bug] wx._core.wxAssertionError #5687

Closed
2 of 7 tasks
lathkar opened this issue Jul 15, 2022 · 4 comments
Closed
2 of 7 tasks

[Bug] wx._core.wxAssertionError #5687

lathkar opened this issue Jul 15, 2022 · 4 comments
Labels
Port - Wx PySimpleGUIWx question Further information is requested

Comments

@lathkar
Copy link

lathkar commented Jul 15, 2022

Type of Issue (Enhancement, Error, Bug, Question)

Bug


Operating System

Windows 10

PySimpleGUI Port (tkinter, Qt, Wx, Web)

Wx


Versions

Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()

Python version (sg.sys.version)

3.6.8

PySimpleGUI Version (sg.__version__)

4.60.1

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

WxPython 4.1.2


Your Experience In Months or Years (optional)

Years Python programming experience

Years Programming experience overall

Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
yes
Anything else you think would be helpful?


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • Searched main docs for your problem www.PySimpleGUI.org
  • Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
  • Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

Detailed Description

wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(0, 0), "C") == 0" failed at ....\src\common\intl.cpp(1694) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this!

Code To Duplicate

A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

This pre-formatted code block is all set for you to paste in your bit of code:

# Paste your code here

Screenshot, Sketch, or Drawing


Watcha Makin?

If you care to share something about your project, it would be awesome to hear what you're building.

@ghost ghost closed this as completed Jul 15, 2022
@ghost ghost added Fill issue form or you will be REJECTED You MUST use the supplied template to submit a request. PySimpleGUI Issues Bot Has Detected an Error labels Jul 15, 2022
@lathkar lathkar changed the title [ Enhancement/Bug/Question] NOTE - you can also call sg.main() or sg.main_open_github_issue() to post an issue Bug Jul 15, 2022
@ghost ghost removed Fill issue form or you will be REJECTED You MUST use the supplied template to submit a request. PySimpleGUI Issues Bot Has Detected an Error labels Jul 15, 2022
@ghost ghost reopened this Jul 15, 2022
Repository owner deleted a comment Jul 15, 2022
@jason990420
Copy link
Collaborator

jason990420 commented Jul 15, 2022

PySimpleGUIWx Version

0.17.2 ?

>>> import PySimpleGUIWx as sg
>>> sg.version
'0.17.1 Released 7-Jun-2020'

wxPython Version ?

4.1.2 ? or 4.1.1 ?

ERROR: Could not find a version that satisfies the requirement wxpython==4.1.2 (from versions: 4.0.0a1, 4.0.0a2, 4.0.0a3, 4.0.0b1, 4.0.0b2, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6, 4.0.7, 4.0.7.post1, 4.0.7.post2, 4.1.0, 4.1.1)
ERROR: No matching distribution found for wxpython==4.1.2

Code To Duplicate

Any code to demo your issue ?

@jason990420 jason990420 added the Port - Wx PySimpleGUIWx label Jul 15, 2022
@lathkar
Copy link
Author

lathkar commented Jul 15, 2022

F:\python36>scripts\pip3 freeze
numpy==1.19.5
Pillow==8.4.0
PySide2==5.15.2.1
PySimpleGUI==4.60.1
PySimpleGUIQt==0.35.0
PySimpleGUIWeb==0.39.0
PySimpleGUIWx==0.17.2
remi==2020.3.10
shiboken2==5.15.2.1
six==1.16.0
wxPython==4.1.1

Error log of calling main() unction in PySimpleGUIWx module:

import PySimpleGUIWx as sg
sg.main()
Traceback (most recent call last):
File "", line 1, in
File "F:\python36\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 8025, in main
event, values = window.Read()
File "F:\python36\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 3073, in Read
results = self._read(timeout=timeout, timeout_key=timeout_key)
File "F:\python36\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 3095, in _read
self.Show()
File "F:\python36\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 2978, in Show
StartupTK(self)
File "F:\python36\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 5393, in StartupTK
icon = PyEmbeddedImage(window.WindowIcon).GetIcon()
File "F:\python36\lib\site-packages\wx\lib\embeddedimage.py", line 59, in GetIcon
icon.CopyFromBitmap(self.GetBitmap())
File "F:\python36\lib\site-packages\wx\lib\embeddedimage.py", line 49, in GetBitmap
return wx.Bitmap(self.GetImage())
File "F:\python36\lib\site-packages\wx\lib\embeddedimage.py", line 64, in GetImage
return wx.Image(stream)
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(0, 0), "C") == 0" failed at ....\src\common\intl.cpp(1694) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this!

@jason990420
Copy link
Collaborator

Just find something

  1. Not sure why the file contenet of your 0.17.2 PySimpleGUIWx is different as mine 0.17.2 PySimpleGUIWx.

  2. There're something changed after wxPython upgraded. Maybe you can try to downgrade wxPython by

pip install wxPython==4.0.7

or

pip install wxPython==4.0.6

Refer wxWidgets/Phoenix#1515

@jason990420
Copy link
Collaborator

I got different exception in my WIN10

d:\>pip freeze
...
PySimpleGUIWx==0.17.2
...
wxPython==4.1.1
d:\>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySimpleGUIWx as sg
>>> sg.version
'0.17.1 Released 7-Jun-2020'
>>> sg.main()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Software\Python\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 8021, in main
    event, values = window.Read()
  File "C:\Software\Python\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 3070, in Read
    results = self._read(timeout=timeout, timeout_key=timeout_key)
  File "C:\Software\Python\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 3092, in _read
    self.Show()
  File "C:\Software\Python\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 2975, in Show
    StartupTK(self)
  File "C:\Software\Python\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 5442, in StartupTK
    PackFormIntoFrame(window, vsizer, window)
  File "C:\Software\Python\lib\site-packages\PySimpleGUIWx\PySimpleGUIWx.py", line 4926, in PackFormIntoFrame
    text_ctrl.Bind(wx.EVT_TEXT_ENTER, element._ReturnKeyHandler)
  File "C:\Software\Python\lib\site-packages\wx\core.py", line 1459, in _EvtHandler_Bind
    event.Bind(self, id, id2, handler)
  File "C:\Software\Python\lib\site-packages\wx\core.py", line 1530, in Bind
    target.Connect(id1, id2, et, function)
wx._core.wxAssertionError: C++ assertion ""HasFlag(0x0400)"" failed at ..\..\src\common\textcmn.cpp(1210) in wxTextCtrlBase::OnDynamicBind(): Must have wxTE_PROCESS_ENTER for wxEVT_TEXT_ENTER to work

After I downgrade my wxpython to 4.0.7, then it work, but failed to close window.

d:\>pip install wxpython==4.0.7
Collecting wxpython==4.0.7
  Using cached wxPython-4.0.7-cp38-cp38-win_amd64.whl (22.9 MB)
Requirement already satisfied: six in c:\software\python\lib\site-packages (from wxpython==4.0.7) (1.16.0)
Requirement already satisfied: numpy in c:\software\python\lib\site-packages (from wxpython==4.0.7) (1.23.1)
Requirement already satisfied: pillow in c:\software\python\lib\site-packages (from wxpython==4.0.7) (9.2.0)
Installing collected packages: wxpython
  Attempting uninstall: wxpython
    Found existing installation: wxPython 4.1.1
    Uninstalling wxPython-4.1.1:
      Successfully uninstalled wxPython-4.1.1
Successfully installed wxpython-4.0.7

d:\>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PySimpleGUIWx as sg
>>> sg.main()
Exit {0: '', 1: '', 2: 'Source', 'Browse': None, 3: 'Dest', 'Browse0': None, 4: False, 5: False, 6: 'Multiline Input', '_COMBO_': 'Combo 2', '_SPIN_': 'Spin a'}
>>>

@lathkar lathkar closed this as completed Jul 25, 2022
@jason990420 jason990420 changed the title Bug [Bug] wx._core.wxAssertionError Jul 25, 2022
@jason990420 jason990420 added the question Further information is requested label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Port - Wx PySimpleGUIWx question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants