I'm a newbie too, so somebody will (surely) provide a better and more
complete explanation :-).
Your problem is you have "overriden" the wx.App.MainLoop (which obviously
stays in a loop of some kind processing windows events).
Your MainLoop() will execute the single line of code and then exit - which
will cause the entire program to exit as it is the last call in the program
I would suggest that you rename your MainLoop and then have it call the real
MainLoop i.e.
聽聽def ChangeTheText:
聽聽聽聽self.frame.out.AppendText("Hello")
聽聽聽聽self.MainLoop()
This should work (well, keep the app running at least, I haven't really
looked at the rest of your code :-))
Peter
路路路
-----Original Message-----
From: Nick Fisher [mailto:wxPython@nickdafish.com]
Sent: Friday, July 18, 2003 8:17 AM
To: wxPython-users@lists.wxwindows.org
Subject: [wxPython-users] Newbie confuzed......
Hello!
聽聽I'm trying (emphasis on the try) to learn wxPython and could do with a
little help
When I run this script:
-----
from wxPython.wx import *
class MyFrame(wxFrame):
聽聽def __init__(self, parent, ID, title):
聽聽聽聽wxFrame.__init__(self, parent, ID, title, wxDefaultPosition,
wxSize(200,
150))
聽聽聽聽self.out = wxTextCtrl(self, 1, style=wxTE_DONTWRAP |
wxTE_READONLY |
wxTE_MULTILINE)
聽聽聽聽self.out.AppendText("Some Text\n")
聽聽聽聽self.out.AppendText("Some more text\n")
class MyApp(wxApp):
聽聽def OnInit(self):
聽聽聽聽self.frame = MyFrame(NULL, -1, "")
聽聽聽聽self.frame.Show(true)
聽聽聽聽self.SetTopWindow(self.frame)
聽聽聽聽return true
聽聽def MainLoop(self):
聽聽聽聽self.frame.out.AppendText("Hello")
app = MyApp(0)
app.MainLoop()
-----
I get this error:
-----
17:51:55: Debug: e:\projects\wx\src\msw\app.cpp(439):
'UnregisterClass(canvas)' failed with error 0x00000584 (class still has
open windows.).
-----
Any ideas why? I sure as heck don't. I'm running Python 2.2.2, wxPython
2.4 on a Win2k system.
Many thanks.....
聽聽Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
Warning: Copyright ResMed. Where the contents of this email and/or attachment includes materials prepared by ResMed, the use of those materials is subject exclusively to the conditions of engagement between ResMed and the intended recipient.
This communication is confidential and may contain legally privileged information. By the use of email over the Internet or other communication systems, ResMed is not waiving either confidentiality of, or legal privilege in,the content of the email and of any attachments.
If the recipient of this message is not the intended addressee, please call ResMed immediately on +61 2 9886 5000 Sydney, Australia.