ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> visualpython-discuss
visualpython-discuss
[Visualpython-discuss] RE: stdout output is not displayed by VisualPython when application stops before wxPython App.Mainloop() is called
by Jurie Horneman other posts by this author
Jan 27 2005 9:21AM messages near this date
view in the new Beta List Site
[Visualpython-discuss] Remote debugging trouble | [Visualpython-discuss] stdout output is not displayed by VisualPython when application stops before wxPython App.Mainloop() is called
Well, I seem to have found a workaround (if only I'd waited 10 minutes
before writing the preceding mail... oh well ;) :

I derive my own output window class from the wxPython one, like so:

class MyOutputWindow(wx.PyOnDemandOutputWindow):
    def __init__(self):
        wx.PyOnDemandOutputWindow.__init__(self)
        self.oldStdout = sys.stdout
    def write(self, text):
        wx.PyOnDemandOutputWindow.write(self, text)
        self.oldStdout.write(text)		# <- write to old stdout
as well as normal wxPython window

And then I install it like this:

    wx.App.outputWindowClass = MyOutputWindow
    App = MyApp()
    App.MainLoop()

And voila.

-----------------------------
Jurie Horneman
senior programmer

ROCKSTAR VIENNA
www.rockstarvienna.com

*** Please be aware that all content of this email ***
*** plus its attachments are strictly confidential ***

-----Original Message-----
From: Jurie Horneman 
Sent: Thursday, January 27, 2005 6:01 PM
To: 'visualpython-discuss@listserv.ActiveState.com'
Subject: stdout output is not displayed by VisualPython when application
stops before wxPython App.Mainloop() is called

When I use VisualPython to write a program that uses wxPython, and
something is written to stdout during the creation of my wx.App
instance, but before App.MainLoop() is called, this output is not shown
in the VisualStudio IDE and is effectively lost.

This may seem esoteric but it actually happens a lot. Typically. If one
uses the wrong variable or class name in any code called during the
initialization of an object of a class derived from wx.App, it is very
hard to find out what went wrong. This seems unnecessary, since the
output works fine at all other times.

Does anyone know of a solution to or workaround for this problem? 

I am evaluating Visual Python 1.8.2, Build 2090, in combination with
Python 2.3.4, and wxPython 2.5.3.1.

-----------------------------
Jurie Horneman
senior programmer

ROCKSTAR VIENNA
www.rockstarvienna.com

*** Please be aware that all content of this email ***
*** plus its attachments are strictly confidential ***

_______________________________________________
Visualpython-discuss mailing list
Visualpython-discuss@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved