While True Statements?

I’m having some trouble with while true statements in python, I’m trying to just change the color of cube over and over again as a test, but it’s not working and instead crashes that tab. Here’s the code I’m currently using, it shouldn’t be that hard to compile: from delightex import *

import random

testCube = scene.get_item(“Test Cuboid”)

while True:

testCube.color = Color(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))

That’s it. That’s the entire code. In the scene it’s one cube and one camera! What’s happening? Does Delightex just not like while true statments?

Okay, figured it out, need to make a function and then call thee function from inside the function. Weird but that’s what works.

That’s a common issue with browser-based scripting. An infinite while loop without a delay doesn’t give the browser a chance to render the frames, which causes the tab to freeze. Using a function or a timer is definitely the standard way to handle that instead.