Scribus Forums

Scribus => Scripts and Plugins => Topic started by: Truman on January 25, 2022, 12:19:51 am

Title: What does redraw do?
Post by: Truman on January 25, 2022, 12:19:51 am
I'm checking out scripts and often a standard I see has to do with redraw.

The only thing I know is that it is disabled for speed.

What does this command do exactly? How does enabling vs disabling it change anything?
Title: Re: What does redraw do?
Post by: RobSay on February 05, 2022, 05:06:43 pm
It literally determines whether or not the items being manipulated in the script will be drawn on the screen.

You can see this in the scripter console. Open a new document and then open scripter and run the following:
Code: [Select]
createText(10,10,100,100,"newTextFrame")
This will appear immediately.

Now run:
Code: [Select]
setRedraw(False)
createText(10,50,100,100,"anotherNewTextFrame")

Nothing appears on the screen - but the console reports the name of the item - this means it has been created.

Now run:
Code: [Select]
setRedraw(True)
[code]
The second frame now appears.

Basically redrawing the screen takes processing power - especially if what is being drawn is graphical such as an image. In large scripts setting redraw to false or explicitly controlling when to redraw can significantly reduce the overall time taken to execute the script the script.