473,402 Members | 2,050 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,402 software developers and data experts.

Displaying text on screen from a text file

3
Hello,

I want to show 3 words at a time from a textfile or pdf. At a specified rate (select time 1/10 to 300 sec). A GUI based display

Expand|Select|Wrap|Line Numbers
  1. f = open("demofile.txt", "r") 
  2. for x in f: print(x) input() 
  3. f.close()
The speed of display and the pause / resume buttons are a problem. Could you help with this? thanks
May 9 '20 #1

✓ answered by lewish95

You could blit the highscores onto another surface and then blit this surf onto the screen. To blit the highscore list, use a for loop and enumerate the list, so that you can multiply the y-offset by i. To toggle the highscore surface, you can just add a variable highscores_visible = False and then do highscores_visible = not highscores_visible, and in the main loop check if highscores_visible: # blit the surf (press 'h' to update and toggle the highscore table in the example below). Of course you need to make sure that the names and highscores fit onto the surface.

3 3643
You could blit the highscores onto another surface and then blit this surf onto the screen. To blit the highscore list, use a for loop and enumerate the list, so that you can multiply the y-offset by i. To toggle the highscore surface, you can just add a variable highscores_visible = False and then do highscores_visible = not highscores_visible, and in the main loop check if highscores_visible: # blit the surf (press 'h' to update and toggle the highscore table in the example below). Of course you need to make sure that the names and highscores fit onto the surface.
May 9 '20 #2
algae
3
Thanks Lewish95. Very detailed and instructive reply. Regards
May 11 '20 #3
algae
3
Hi Lewish95, thanks for your detailed help. I couldn't make it happen as you suggested.
could you give a few code lines

thanks
May 17 '20 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Thomas | last post by:
Hi there, a while ago, I posted a question regarding reading japanese text from a text file. Well, since I solved the problem, I thought I'd post my solution for the benefit of other people with...
2
by: Samuel | last post by:
Hi I would like to replace a string to an another into a text file (not a XML) Have someone a example that I can take a look ti Samuel
6
by: zoneal | last post by:
Size of text file to read and display can be larger than 10MB. Since I must ignore certain input text lines the code I'm using is: FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) 'Read...
4
by: srikanthv | last post by:
I have below Sample text. I need find in the text specfic "Key name" its Value "HKEY_CURRENT_USER\Control Panel\International", If I find this I need to go inside of this and read Value 0 (Name:...
3
by: Dave Kelly | last post by:
Given this html code page; ======begin <html> <body> <!--#include file="outing.1.shtml"--> <form action="form.php" method="GET"> <input type="hidden" name="op" value="ds"> <table width="468"...
2
by: ahynes | last post by:
HI folks, I'm a chem engineer with no VB programming knowledge (as you'll see from my question!) I want a script to open a .txt file, insert pre-defined text into the start and end of the...
2
by: ahynes | last post by:
HI folks, I need a script to open a .txt file, insert pre-defined text into the start and end of the file, then close teh saved file with a .nc extension. I'd like to have this so I can run it...
0
by: waqasahmd | last post by:
Hi I am using FAXCOMLib to send fax. Now I created a string which is the text to be printed. This text string contains some hard code values, some values from db.. I can send a simple plain...
5
by: Chocolade | last post by:
All the solutions here are great. But for now im keeping on my own code cuz i want also to learn the way i started to do it. So what i did so far is: private void inloop() {
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.