Displaying text on screen from a text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • algae
    New Member
    • May 2020
    • 3

    Displaying text on screen from a text file

    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

    Code:
    f = open("demofile.txt", "r") 
    for x in f: print(x) input() 
    f.close()
    The speed of display and the pause / resume buttons are a problem. Could you help with this? thanks
    Last edited by gits; May 11 '20, 07:10 PM. Reason: added code tags
  • lewish95
    New Member
    • Mar 2020
    • 33

    #2
    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_visi ble = False and then do highscores_visi ble = not highscores_visi ble, and in the main loop check if highscores_visi ble: # 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.

    Comment

    • algae
      New Member
      • May 2020
      • 3

      #3
      Thanks Lewish95. Very detailed and instructive reply. Regards

      Comment

      • algae
        New Member
        • May 2020
        • 3

        #4
        Hi Lewish95, thanks for your detailed help. I couldn't make it happen as you suggested.
        could you give a few code lines

        thanks

        Comment

        Working...