Python Forum

Full Version: Process finished with exit code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Not sure what is wrong. I am using PyCharm and it shows no errors. But when I run it I get: Process finished with exit code -1073741571 (0xC00000FD)

import wx
import wx.xrc


class MyApp(wx.App):
    def OnInit(self):
        self.frame = MyFrame(None)
        self.SetTopWindow(self.frame)
        self.frame.Show()
        return True


class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"My List", pos=wx.DefaultPosition, size=wx.Size(500, 400),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
        self.SetBackgroundColour(wx.Colour(0, 128, 128))

        myFlexGridSizer = wx.FlexGridSizer(1, 1, 0, 0)
        myFlexGridSizer.SetFlexibleDirection(wx.BOTH)
        myFlexGridSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        myBoxGridSizer = wx.BoxSizer(wx.VERTICAL)

        self.headerLabel = wx.StaticText(self, wx.ID_ANY, u"Glucose", wx.Point(-1, -1), wx.DefaultSize, 0)

        self.headerLabel.Wrap(-1)
        self.headerLabel.SetFont(wx.Font(wx.NORMAL_FONT.GetPointSize(), 75, 90, 92, True, wx.EmptyString))

        myBoxGridSizer.Add(self.headerLabel, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)

        mListBoxChoices = [u"Update Data", u"A1c", u"Exit"]
        self.mListBox = wx.ListBox(self, wx.ID_ANY, wx.Point(-1, -1), wx.Size(300, 300), mListBoxChoices, wx.LB_SINGLE)
        self.mListBox.SetFont(wx.Font(12, 75, 90, 90, False, wx.EmptyString))

        myBoxGridSizer.Add(self.mListBox, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)

        myFlexGridSizer.Add(myFlexGridSizer, 1, wx.EXPAND, 5)

        self.SetSizer(myFlexGridSizer)
        self.Layout()
        self.Centre(wx.BOTH)

        self.mListBox.Bind(wx.EVT_LISTBOX, self.showSelectedItem)

    def __del__(self):
        pass

    def showSelectedItem(self, event):
        wx.MessageBox(event.GetEventObject().GetStringSelection(), "Selected")


app = MyApp(False)
MyFrame.Show()
app.MainLoop()
Being new to python I tried to find the answer but nothing fit to my problem.
What happens if you remove line 56? Your app already creates and shows the frame, so showing it again (and without a root object) seems odd.
It could be a PyCharm issue, does it occur if you run the code in an ordinary terminal out of PyCharm?
Yes, it does.

But I redid the coded so it was more up to date with Python 3.7 and everything now works fine

Thank you