question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there any way to redraw an image that constantly changes?

See original GitHub issue

I’ve tried ColourImageFile but that for some reason only renders it once then doesnt render it ever again, it would probably destroy my CPU if it did so but its a risk im willing to take, is there any way to constantly re render this image and pass it onto a Print effect? Sorry if this isnt the right place to ask questions but I really have no idea where to post this

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
peterbrittaincommented, Feb 6, 2021

Hi. For general questions, you can always use the asciimatics lobby on gitter.

I’m not sure what you’re asking… ColourImageFile will pull out all the images from an animated image and display them at the desired rate (that you specify as the speed in the Print Effect).

Do you mean that some other application is constantly writing a new (single) image to the file and so you want to be able to read that every time the file changes? If so, you will have to create a new ColourImageFile object each time the file changes. You could do that using a separate thread to monitor the file and build the object as needed. Finally you’d also need to update the Scene in some way to pick up the new object… Easiest way to do that would be to remove the old Print Effect and add a new one for the new image instead.

0reactions
Sarif-HKcommented, Feb 23, 2021

Oh yeah, that did work, sorry for not closing the issue myself! Here’s the code if anyone needs an example:

def fetchImage(screen):
    image = ColourImageFile(screen, r'FILEHERE', height= screen.height)
    screen.play([Scene([Print(screen, image, y=0)])])

@ManagedScreen
def Main(screen):
    fetcher = thr.Thread(target=fetchImage, daemon=True, args=(screen, ))
    fetcher.start()
    screen.force_update()
    screen.refresh()
    sleep(10)
Main()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Does Canvas redraw itself every time anything changes?
This concept of redrawing on translation is fairly self-evident, as the canvas has no method of deleting from the present context.
Read more >
draw() / Reference / Processing.org
To stop the code inside of draw() from running continuously, use noLoop(), redraw() and loop(). If noLoop() is used to stop the code...
Read more >
Pixelmator Pro
Make small imperfections or even entire objects disappear from your images by painting over them with the Repair Tool. No matter how complex...
Read more >
How to: Use a Drawing Tool | Microsoft Learn
Use the Image Editor toolbar or go to menu Image > Tools and select a Closed-Figure Drawing tool. · If necessary, select colors...
Read more >
Tools - ImageJ
Use Edit>Draw to permanently draw the line on the image. Change the drawing color by clicking in the Image>Colors>Color Picker window. Double click...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found