Newbie confuzed......

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
:slight_smile:

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 :confused:
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.

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
:slight_smile:

Yup, I'm aware of that.

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 :-))

My problem was that I couldn't figure out the error message. Having read
your post though, I suddenly realised that I was closing the app without
closing the open frame! Duhhhh....
Thanks Peter :wink:

  Nick

Why doesn't wxTextCtrl change colour when I call
SetBackgroundColour on Linux? It works on Windows.

Thanks,
Susanne

Susanne Lefvert wrote:

Why doesn't wxTextCtrl change colour when I call SetBackgroundColour on Linux? It works on Windows.

Some gtk themes don't allow it. For example if you remove your ~/.gtkrc so you'll be themeless then run your app again then I expect that you'll then be able to see the colour changes.

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!