Hey folks - trying to run a piece of code (listed at bottom): modified from the “getting started” tutorial;
When running gives the following error:
File “C:\Users\crobertson\Desktop\Development\Programming Assets\Python\TEMP files\gui_test 2.py”, line 55, in UI_init
“exit.png”,wx.BITMAP_TYPE_PNG
File “C:\Python27\lib\site-packages\wx-3.0-msw\wx_core.py”, line 2882, in init
core.Image_swiginit(self,core.new_Image(*args, **kwargs))
PyAssertionError: C++ assertion “strcmp(setlocale(LC_ALL, NULL), “C”) == 0” failed at …\src\common\intl.cpp(1449) 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!
``
This is the code it runs from
class display(wx.Frame):
#create a child class called “display” which is inherited from the “wx.Frame()” object
def init(self, *args, **kwargs):
#this addes the original init class to this class
#(in effect we are appending our modifications to it)
super(display,self).init(*args, **kwargs)
self.UI_init()
def UI_init(self):
menubar=wx.MenuBar()
filemenu=wx.Menu()
quit_app=wx.MenuItem(filemenu, APP_EXIT, "&Quit\tCtrl+Q")
quit_app.SetBitmap(
wx.Image(
"exit.png",wx.BITMAP_TYPE_PNG
).ConvertToBitmap()
)
filemenu.AppendItem(quit_app)
self.Bind(wx.EVT_MENU,self.OnQuit,id=APP_EXIT)
menubar.Append(filemenu, "&File")
self.SetMenuBar(menubar)
self.SetSize((400,500))
self.SetTitle("Icons and Shortcuts TUTORIAL!")
self.Centre()
self.Show(True)
def OnQuit(self, e):
self.Close()
def main():
ex = wx.App()
display(None)
ex.MainLoop()
if name == ‘main’:
main()
``