473,657 Members | 2,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1256
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.writ e(message)
self.the_file.w rite(message)

my_file = open("my_text.t xt", "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
3046
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 to have an easier time understanding what I do. Therefore this weekend I'm going to spend 3 days just writing comments. Before I do it, I thought I'd ask other programmers what information they find useful. Below is a typical class I've...
13
3624
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 server, I am trying: $_SESSION = "/uploaddir/"; // directory on server $_SESSION = "c:/_picture_file/"; // directory on computer
8
3305
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, www.publicpen.com/staengl, when I point my browser there, the browser, instead of showing me the index.htm pages like it should, it instead tries to download it as an object. Why? Below are the contents of index.htm. Does anyone see anythging...
4
2944
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, like DOS, uses memory-mapped display, two bytes per character (one char byte and one attribute byte). We can get the screen offset allright, and I've written a javascript which does the math to convert the offset into row/col (i.e. left, top)...
2
1712
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 different recordsets in the XML file and hence change the text displayed in the HTML page. I use JavaScript to display the contents of the iframe in a separate window. The new window displays the HTML page. The problem is that contents of the HTML...
4
2638
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 of a bunch of strings. This works great as long as all I want is the results of those Response.Writes I believe what I REALLY want is to convert those Response.Writes to a str cat in the code behind, and then in the body of my .aspx page to do...
0
1383
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 code on the wait page: -------------- <script language="javascript"> var iLoopCounter = 1; var iMaxLoop = 5; var iIntervalId;
4
1759
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 something when they upgraded to PHP5). Everytime a user tries to download the file, it displays the contents on the screen. Here is what I have for my file handling. Am I missing anything obvious? when called, $filecontent is displayed to the...
2
1674
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. What I have is the following: @ob_end_clean(); $SHOW = "1"; if ($SHOW == 1) { // Show all the info on a page
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.