Bottom Page

Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] Process finished with exit code
#1
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.
Gary
Quote
#2
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.
Quote
#3
It could be a PyCharm issue, does it occur if you run the code in an ordinary terminal out of PyCharm?
Quote
#4
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
Gary
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Tkinter] How to exit when multiple root windows. weatherman 4 560 May-10-2018, 11:52 PM
Last Post: Larz60+
  OnExit closes windows, but dosen't exit application Larz60+ 3 945 Sep-23-2017, 06:12 PM
Last Post: snippsat
  How to fork a process, kill the child and not kill the parent? neXussT 3 2,064 Mar-04-2017, 09:35 PM
Last Post: neXussT
  [PyGUI] Unknown error: kernel process exited MlleFidna 1 2,551 Nov-29-2016, 10:38 PM
Last Post: nilamo

Forum Jump:


Users browsing this thread: 1 Guest(s)