473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Write to file and see content on screen

Hello all,

New user to python. I can write to a file, however, I would like to
do both...whatever I do on the screen, I'd like to write it to a file.

any pointers on where I can find this info.

thanks,
Jun 27 '08 #1
2 1250
CM
On Jun 9, 9:01 pm, lama...@verizon.net wrote:
Hello all,

New user to python. I can write to a file, however, I would like to
do both...whatever I do on the screen, I'd like to write it to a file.

any pointers on where I can find this info.

thanks,
There is probably some smart way to do this that I don't know, but
in wxPython you could have your textbox and bind it to an EVT_TEXT
event, and then in the event handler for that write the contents of
the textbox to your file. This way on any change in the textbox,
there would be a write to the file. But I don't know if that is
practical or if the writes would keep up well. You could also have
a counter and when the counter reaches x characters then do a write.
Or you could set a timer and do the write every x seconds.

Jun 27 '08 #2
On Jun 10, 2:01 am, lama...@verizon.net wrote:
Hello all,

New user to python. I can write to a file, however, I would like to
do both...whatever I do on the screen, I'd like to write it to a file.

any pointers on where I can find this info.

thanks,
Something like this, perhaps?

class Storage(object):
def __init__(self, the_file):
self.the_file = the_file
def write(self, message):
import sys
sys.stdout.write(message)
self.the_file.write(message)

my_file = open("my_text.txt", "w")
store = Storage(my_file)
print >store, "Hello world!"
my_file.close()
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
13
by: Ken | last post by:
How do I download files from the internet server to my computer? How do I tell the script the correct hard drive folder on my computer to copy the files to? After connecting to the internet...
8
by: lawrence | last post by:
Under the domain publicpen.com I've several dozen sites in subdiretories, such as www.publicpen.com/honenbeger. I've no trouble with any of these sites. But under one, which I put in yesterday,...
4
by: Prowler | last post by:
In the application we are currently building, we need to write positioning code on-the-fly, based upon the screen offset of the element in the AS/400 application which drives the Web app. The 400,...
2
by: seans | last post by:
Hi, please can somebody help me with this? I have a HTML document displayed in an iframe. Controls on the HTML page are data bound to an XML file. I use a drop-down list to move between the...
4
by: etropic | last post by:
Im confused I want an .aspx page to have a table with my data in it. At first I wrote FillTablew(); in my Page_Load even in the Code Behind file. I had it loop the db etc. and use Response.Write...
0
by: Manuel | last post by:
I have a page that uploads a file to the user. Since the file is created on the fly and it takes a few seconds to generate, I present a "Please Wait" screen until the file is uploaded. This is the...
4
by: Brad | last post by:
I have a file that downloaded a CSV file for the user based upon some information gathered from the Database. My file was working fine until recently (I believe that my hosting company did...
2
by: houghi | last post by:
I am trying to do two things at a time. I want to give the user the opportunity to save a file and at the same time see new information on the screen. I can do it seperately, but not together....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.