473,394 Members | 1,749 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,394 software developers and data experts.

Blinky Program

Hello again Everyone,

I spent a small amount of time recently writing a program that "blinks"
text. I did it by first having a user input a string,
sys.stdout.write-ing the string, then backing up judging by the number of
characters the string has, re-stdout's over it with blank spaces (judged
again by it's character count), and then backs up again in a never ending
while loop. It keeps each blink .5 seconds spaced as well, and all in the
same position.

Here is the code.

[start code]

#blinky.py
#Make a blinking user inputed (strings) character by using self made "blinky"
#function.

strings = raw_input("Please enter something to blink: ")

#blinky(string_argument, time_pause)
def blinky(strings1, pause):

import string,time,sys

string_length = len(strings1)

replacement = string.replace(strings1,strings1," ")

float(pause)

while 1:
sys.stdout.write(strings1)
sys.stdout.flush()
time.sleep(pause)

sys.stdout.write("\b"*string_length)

sys.stdout.write(" "*string_length)
sys.stdout.flush()
time.sleep(pause)

sys.stdout.write("\b"*string_length)

blinky(strings, .5)

[end code]

My question is that I was recently informed by someone that I could help
free up some memory usage by alleviating the sys.stdout.flush's in the
code, but I need those in order to keep the "blinking" text in place.

Is there any way I can actually free up memory usage in the terms of the
sys.stdout.flush that any of you can notice? I'm simply curious now after
being informed.

Thanks again,

~Ryan
Jul 18 '05 #1
2 1406
Ryan Spencer wrote:
[..] I was recently informed by someone that I could help
free up some memory usage by alleviating the sys.stdout.flush's in the
code, [...]


This decidedly sounds like somebody's brainfart.

-- Gerhard

Jul 18 '05 #2
On Fri, 28 Nov 2003 17:16:08 +0100, Gerhard Häring wrote:
Ryan Spencer wrote:
[..] I was recently informed by someone that I could help
free up some memory usage by alleviating the sys.stdout.flush's in the
code, [...]


This decidedly sounds like somebody's brainfart.

-- Gerhard


Hehe, All righty then. Thanks Gerhard.

~Ryan
Jul 18 '05 #3

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

Similar topics

22
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html ...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
11
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
1
by: Eric Whittaker | last post by:
hi all, im trying to write my first c++ program. a success, but i can't get the window to stay open after user enters input. it just automatically closes. right now the end of my program looks...
9
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working...
7
by: ibtc209 | last post by:
I just started programming in C, and I need some help with this problem. Your program will read the information about one MiniPoker hand, namely the rank and suit of the hand’s first card, and...
2
Banfa
by: Banfa | last post by:
Posted by Banfa The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.