My code is pretty straight forward, but I keep getting the error below. I researched the error and it pretty much says IDLE and my own GUI are screwing each other up, but I don't really know how to avoid it. I mean, if I just click on the .py file for my GUI without having IDLE open, I get the same error.
Any ideas?
Python 2.7 Windows XP
import wx
class applicationName(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, 'Title', size=(300,200))
panel = wx.Panel(self)
box = wx.TextEntryDialog(None, "How old are you?", "Title", "default text")
if box.ShowModal() == wx.ID_OK:
answer = box.GetValue()
if __name__ =='__main__':
app = wx.PySimpleApp()
frame = applicationName(parent=None, id=-1)
frame.Show()
app.MainLoop()
Error:
PyNoAppError: The wx.App object must be created first!
I guess you encountered this problem when you were debugging your program second time.
You can add the line at the end of the code.
del app
I hope it can help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With