What is this supposed to mean? This has nothing to do with the problem.
If for expample you make this:
window.display()
window.display() // make it twice
You'll get a flickering screen.
The code that he provide is not clear at all. A compilable example will give us the opportunity of see the error and correct it , then we can post the correct code and explain better the problem.
Yeah, we are not here to code for others, but we can test and correct a minimal example that show the error.
You give the answer, but he could need to know where is the problem and how avoid it in the future.